Giter Site home page Giter Site logo

lua-time's Introduction

Summary

lua-time is a simple and small library that provides some time methods that are lacking on standart library.

Support

Send me a message on github , I'll support as soon as possible and when it is possible.

License

BEER-WARE, see source file

Prerequisites

Installation

Tested on windows only, compatible with *NIX systens. You only need to edit some vars on makefile, for basic instalation use:

# make

If you have upx use this for better output.

# make release

For cleanup

# make clean

Methods

require 'time'

time.getSeconds() 		-- return time in seconds since EPOCH, ex: 1318215923

time.getMiliseconds() 	-- return time in seconds and milisenconds since EPOCH, ex: 1318215923.112

time.getMicroseconds()	-- return time in microseconds relative to seconds since EPOCH, ex: 0.903249

time.getTime()			-- return time in seconds, microseconds and microseconds since EPOCH, ex: 1321559562	0.971 	0.971777

time.getDiff( <seconds/miliseconds> )		-- return the difference between a given time and now.

Test

There's a file 'time_bench.lua' that have a benchmark using a bitwise library ( http://bitop.luajit.org/ ) ...

History

One day, some friend of mine asked me to make a benchmark between Lua and AS3 (Action Script 3). He's doing some code improvements in a game that we are developing, mostly at "round method" provided by AS3 math library, and as I know native methods may peform better than workarounds, but in AS3 a round method made in bitwise could peform much faster than native round method ... so I accept the chalenge and I realize that Lua doesn't have a method that provide a milisecond precision. Then I found myself in a second chalenge and here I go!

PS: for the record, Lua (LuaJIT) is about 100x faster than AS3 round method (bitwise) and Lua native math library is 2-3x faster than bitwise method.

% October 10th, 2011 -03 GMT

lua-time's People

Contributors

leite avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.