lua-users home
lua-l archive

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

> [...]
> After some research, I was surprised to discover that os.time()
> modifies the datetime table passed in. Here is the proof:
> [...]

The parameter to 'os.time' is what is called an "in-out" parameter. It
follows the behavior of the corresponding C function, 'mktime':

     The  mktime()  function modifies the fields of the tm structure as fol‐
     lows: tm_wday and tm_yday are set to values determined  from  the  con‐
     tents of the other fields; if structure members are outside their valid
     interval, they will be normalized (so that, for example, 40 October  is
     changed  into  9  November); tm_isdst is set (regardless of its initial
     value) to a positive value or to 0, respectively, to  indicate  whether
     DST  is  or  is  not in effect at the specified time.

The normalization property seems specially useful.

-- Roberto