parent
d2c1327f57
commit
295d45fb26
@ -224,6 +224,7 @@ LJLIB_CF(os_date)
|
|||||||
LJLIB_CF(os_time)
|
LJLIB_CF(os_time)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
|
errno = 0;
|
||||||
if (lua_isnoneornil(L, 1)) { /* called without args? */
|
if (lua_isnoneornil(L, 1)) { /* called without args? */
|
||||||
t = time(NULL); /* get current time */
|
t = time(NULL); /* get current time */
|
||||||
} else {
|
} else {
|
||||||
@ -237,7 +238,6 @@ LJLIB_CF(os_time)
|
|||||||
ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u);
|
ts.tm_mon = (int)((unsigned int)getfield(L, "month", -1) - 1u);
|
||||||
ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u);
|
ts.tm_year = (int)((unsigned int)getfield(L, "year", -1) - 1900u);
|
||||||
ts.tm_isdst = getboolfield(L, "isdst");
|
ts.tm_isdst = getboolfield(L, "isdst");
|
||||||
errno = 0;
|
|
||||||
t = mktime(&ts);
|
t = mktime(&ts);
|
||||||
}
|
}
|
||||||
if (t == (time_t)(-1) && errno != 0)
|
if (t == (time_t)(-1) && errno != 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user