Skip to content

Commit

Permalink
date related conversion
Browse files Browse the repository at this point in the history
Signed-off-by: farteryhr <[email protected]>
  • Loading branch information
farteryhr committed Aug 4, 2018
1 parent 2b739d7 commit 6b97c8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions loslib.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ static void setallfields (lua_State *L, struct tm *stm) {
setfield(L, "min", stm->tm_min);
setfield(L, "hour", stm->tm_hour);
setfield(L, "day", stm->tm_mday);
setfield(L, "month", stm->tm_mon + 1);
setfield(L, "month", stm->tm_mon);
setfield(L, "year", stm->tm_year + 1900);
setfield(L, "wday", stm->tm_wday + 1);
setfield(L, "yday", stm->tm_yday + 1);
setfield(L, "wday", stm->tm_wday);
setfield(L, "yday", stm->tm_yday);
setboolfield(L, "isdst", stm->tm_isdst);
}

Expand Down Expand Up @@ -333,7 +333,7 @@ static int os_time (lua_State *L) {
ts.tm_min = getfield(L, "min", 0, 0);
ts.tm_hour = getfield(L, "hour", 12, 0);
ts.tm_mday = getfield(L, "day", -1, 0);
ts.tm_mon = getfield(L, "month", -1, 1);
ts.tm_mon = getfield(L, "month", -1, 0);
ts.tm_year = getfield(L, "year", -1, 1900);
ts.tm_isdst = getboolfield(L, "isdst");
t = mktime(&ts);
Expand Down

0 comments on commit 6b97c8c

Please sign in to comment.