[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: os.time() unable to read in UTC times
- From: Asko Kauppi <askok@...>
- Date: Fri, 2 May 2008 14:46:05 +0300
I've got historical UTC timestamps, and I want to get the
corresponding local time (based on the OS's locale) for them.
This cannot be done in Lua 5.1 since 'os.time()' only calls for
'mktime()', never 'timegm'. These two are a pair, and described
together on the man pages (man mktime). mktime is for creating epoch
ticks out of local time; timegm is for doing the same from UTC time.
Is there a reason for the omission, and could 'os.time()' support UTC
input in the future?
For example, add a second parameter (boolean), or '.utc=true' to the
current calling scheme. Both would be backwards compatible.
-asko
Oh, well...
"The timegm function is not specified by any standard; its function
cannot be completely emulated using the standard functions described
above."
http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=timegm
It's annoying to see the ANSI limitations limiting Lua time and again.