lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I apologize in advance for the "CSCI 99" nature of this post.

I'll start with the most important question that I have, and then the
reason that I'm asking it:

When daylight savings hits, does os.time() shift with it?

The reason that I'm asking this dumb question is that I am confused by
the following:

> =os.time() - os.time("*t"))
> =os.time() - os.time("!*t"))

According to every definition that I've read, time() returns "number
of seconds since 00:00 hours, Jan 1, 1970 *UTC*"

That would lead me to believe that  passing in a table with the
current date and time in UTC would result in the same answer as
`os.time(nil)` ... but it doesn't. I need to pass in "*t" to get that.
So, then I wonder how this behavior wouldn't be described as, "The
value returned represents the number of seconds since 00:00 hours, Jan
1, 1970, *shifted to the local time zone.*"

I'd blame Windows, but this is also true on my Mac. So now I think I'm
just not understanding this.

The second reason that I'm confused is that "isdst" is currently set
to true, which means that I'm actually off by -5 hours, not -6 (
-21600 / 60 / 60 ). So the answer not only seems wrong, but
unhelpfully so.

I've read the Lua Wiki, looked through Lua's source (noticed it's
doing next to nothing, in terms of trickery, os it's not to blame) and
have LuaDate. I still wonder whether or not os.time() shifts when dst

I hate time.