summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraalatchm <aalatchm@jamailca.com>2011-03-22 18:27:11 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-22 20:58:50 +0000
commit129ad98fe0e178a1b5c3870074eb28bf1b80ba67 (patch)
treeefdade23613f74f63a906e6f7ab42e75848650e7
parentf09479f7052f55c89ca6197daae566b281cc0bc7 (diff)
downloadposixtz-129ad98fe0e178a1b5c3870074eb28bf1b80ba67.tar.bz2
posixtz-129ad98fe0e178a1b5c3870074eb28bf1b80ba67.tar.xz
some cleanup of posixtz.lua
Ensure that string library is loaded by explicitly requiring it. Corrected comments. Added TODO for dealing with leap years.
-rw-r--r--posixtz.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/posixtz.lua b/posixtz.lua
index 74d5d98..ae84275 100644
--- a/posixtz.lua
+++ b/posixtz.lua
@@ -3,7 +3,7 @@
-- Copyright (C) 2011 H. Andrew Latchman <aldevel@jamailca.com>
--
-- Performs some validation of TZ string
--- based on fields to determine offset and dst settings
+-- based on fields needed to determine offset and dst settings
--
-- See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
-- TZ variable, with no leading colon
@@ -14,10 +14,10 @@
-- Import Section
-- declare everything this module needs from outside
local error = error
-local string = string
local tonumber = tonumber
local pairs = pairs
local ipairs = ipairs
+local string = require('string')
local core = require('posixtz.core')
-- Rest of the code is part of module "posixtz"
@@ -137,7 +137,7 @@ function parse ( str )
local remaindays = tonumber(dayofyear)
for i, n in ipairs(monkey) do
if remaindays > n then
- -- Jnday is not in this month
+ -- dayofyear is not in this month
remaindays = remaindays - n
else
month = i
@@ -160,7 +160,7 @@ function parse ( str )
-- n format (zero-based Julian day, [0 <= n <= 364/5], counting Feb 29)
t.nday = string.match(spec, '^(%d+)')
if t.nday then
-
+ -- TODO: determine if the desired year is a leap year
monkey[2] = 29
whichmonth(t.nday + 1)