From 129ad98fe0e178a1b5c3870074eb28bf1b80ba67 Mon Sep 17 00:00:00 2001 From: aalatchm Date: Tue, 22 Mar 2011 18:27:11 +0000 Subject: some cleanup of posixtz.lua Ensure that string library is loaded by explicitly requiring it. Corrected comments. Added TODO for dealing with leap years. --- posixtz.lua | 8 ++++---- 1 file 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 -- -- 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) -- cgit v1.2.3