mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
fix bug in epoch time calculation
This commit is contained in:
parent
f109933533
commit
cc5de8f5e5
1 changed files with 4 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ clite.libs.load('libtime','time',function(io,env) {
|
|||
t = t.toString();
|
||||
}
|
||||
clite.io.close(io.pid,fd);
|
||||
console.log(t);
|
||||
return parseInt(t,10);
|
||||
}
|
||||
function genTime(time,tz) {
|
||||
|
|
@ -74,12 +75,12 @@ return Object.create({
|
|||
return genTime(time,tz);
|
||||
},
|
||||
mktime:function(timeptr) {
|
||||
var t = data.days[timeptr.tm_wday]+' '+data.months[timeptr.tm_mon]+' '+timeptr.tm_mday+' '+timeptr.tm_hour+':'+timeptr.tm_min+':'+timeptr.tm_sec+' '+(1900+timeptr.tm_year);
|
||||
return (new Date(t)).getTime();
|
||||
var t = data.days[timeptr.tm_wday]+' '+data.months[timeptr.tm_mon]+' '+timeptr.tm_mday+' '+timeptr.tm_hour+':'+timeptr.tm_min+':'+timeptr.tm_sec+' '+(1900+timeptr.tm_year+' UTC');
|
||||
return parseInt(Math.floor((new Date(t)).getTime()/1000.0).toFixed(0));
|
||||
},
|
||||
time:function() {
|
||||
var t = readTime();
|
||||
return Math.floor(t/1000.0); // convert from milliseconds to seconds
|
||||
return parseInt(Math.floor(t/1000.0).toFixed(0)); // convert from milliseconds to seconds
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue