Changes between Initial Version and Version 1 of TimeUtils


Ignore:
Timestamp:
2010-02-26 09:14:41 (15 years ago)
Author:
javier_guerra
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TimeUtils

    v1 v1  
     1 
     2== timeutils.lua == 
     3 
     4This is a standard Lua module.  To install it on Vera, upload to `/usr/lib/lua/`.  To use it, start your code with 
     5{{{ 
     6require "timeutils" 
     7luup.timezone = -5      -- replace with your timezone 
     8}}} 
     9 
     10('''Note:''' currently it seems UI3 doesn't store the configured timezone in the `luup` table.  When this issue gets resolved, we should get rid of that manual timezone setting. 
     11 
     12 
     13'''`timeutils.lastmidnight ([time])`::''' 
     14  Returns the timestamp of the last midnight equal or preceding the given `time`.  If no `time` is given, assumes current time. 
     15 
     16'''`timeutils.dayseconds ([time])`''':: 
     17  Returns the number of seconds since the last midnight to the given `time`.  If no `time` is given, assumes current time. 
     18 
     19'''`timeutils.localtoUTC ([time] [, timezone])`''':: 
     20  Returns the 'date table' (same as returned by `os.date('*t', time)`) of the UTC time corresponding to the given `time`.  If no `time` is given, assumes current time.  If no `timezone` is given, assumes Vera's configured timezone. 
     21 
     22'''`timeutils.degrees (x [, ...])`''':: 
     23  Transforms one or more numbers expressing an angles in degrees into strings with degrees, minutes and seconds.  For example: 
     24{{{ 
     25timeutils.degrees (23.2323) 
     26=> 23°13'56.28" 
     27}}} 
     28 
     29'''`timeutils.sun_position ([time] [, place])`''':: 
     30  Returns sun's altitude and azimuth, in degrees, for the given `time` and `place`.  If no `time` is given, assumes current time.  The `place` parameter, if given, must be a table with `latitude`, `longitude` and `timezone` fields.  If no `place` is given, uses the global `luup` table, which should have those fields. 
     31 
     32'''`timeutils.is_dark ([ime] [, place])`''':: 
     33  Returns a boolean indicating if the sun is below the horizon.