@@ -397,21 +397,6 @@ LibraryManager.library = {
397397 return ( ( Date . now ( ) - _clock . start ) * ( { { { cDefine ( 'CLOCKS_PER_SEC' ) } } } / 1000 ) ) | 0 ;
398398 } ,
399399
400- time__sig : 'ii ',
401- time : function ( ptr ) {
402- { { { from64 ( 'ptr' ) } } } ;
403- var ret = ( Date . now ( ) / 1000 ) | 0 ;
404- if ( ptr ) {
405- { { { makeSetValue ( 'ptr' , 0 , 'ret' , 'i32' ) } } } ;
406- }
407- return ret ;
408- } ,
409-
410- difftime__sig : 'dii ',
411- difftime : function ( time1 , time0 ) {
412- return time1 - time0 ;
413- } ,
414-
415400 _mktime_js__sig : 'ii ',
416401 _mktime_js : function ( tmPtr ) {
417402 var date = new Date ( { { { makeGetValue ( 'tmPtr' , C_STRUCTS . tm . tm_year , 'i32' ) } } } + 1900 ,
@@ -1275,7 +1260,8 @@ LibraryManager.library = {
12751260 setErrNo ( { { { cDefine ( 'EINVAL' ) } } } ) ;
12761261 return - 1 ;
12771262 }
1278- { { { makeSetValue ( 'tp' , C_STRUCTS . timespec . tv_sec , '(now/1000)|0' , 'i32' ) } } } ; // seconds
1263+ // struct timespec { time_t tv_sec; long tv_nsec; };
1264+ { { { makeSetValue ( 'tp' , C_STRUCTS . timespec . tv_sec , '(now/1000)|0' , 'i64' ) } } } ; // seconds
12791265 { { { makeSetValue ( 'tp' , C_STRUCTS . timespec . tv_nsec , '((now % 1000)*1000*1000)|0' , 'i32' ) } } } ; // nanoseconds
12801266 return 0 ;
12811267 } ,
@@ -1293,16 +1279,18 @@ LibraryManager.library = {
12931279 setErrNo ( { { { cDefine ( 'EINVAL' ) } } } ) ;
12941280 return - 1 ;
12951281 }
1296- { { { makeSetValue ( 'res' , C_STRUCTS . timespec . tv_sec , '(nsec/1000000000)|0' , 'i32' ) } } } ;
1282+ // struct timespec { time_t tv_sec; long tv_nsec; };
1283+ { { { makeSetValue ( 'res' , C_STRUCTS . timespec . tv_sec , '(nsec/1000000000)|0' , 'i64' ) } } } ;
12971284 { { { makeSetValue ( 'res' , C_STRUCTS . timespec . tv_nsec , 'nsec' , 'i32' ) } } } // resolution is nanoseconds
12981285 return 0 ;
12991286 } ,
13001287 gettimeofday__sig : 'iii ',
13011288 // http://pubs.opengroup.org/onlinepubs/000095399/basedefs/sys/time.h.html
13021289 gettimeofday : function ( ptr ) {
13031290 var now = Date . now ( ) ;
1304- { { { makeSetValue ( 'ptr' , C_STRUCTS . timeval . tv_sec , '(now/1000)|0' , 'i32' ) } } } ; // seconds
1305- { { { makeSetValue ( 'ptr' , C_STRUCTS . timeval . tv_usec , '((now % 1000)*1000)|0' , 'i32' ) } } } ; // microseconds
1291+ // struct timeval { time_t tv_sec; suseconds_t tv_usec; };
1292+ { { { makeSetValue ( 'ptr' , C_STRUCTS . timeval . tv_sec , '(now/1000)|0' , 'i64' ) } } } ; // seconds
1293+ { { { makeSetValue ( 'ptr' , C_STRUCTS . timeval . tv_usec , '((now % 1000)*1000)|0' , 'i64' ) } } } ; // microseconds
13061294 return 0 ;
13071295 } ,
13081296
@@ -1312,7 +1300,8 @@ LibraryManager.library = {
13121300
13131301 ftime : function ( p ) {
13141302 var millis = Date . now ( ) ;
1315- { { { makeSetValue ( 'p' , C_STRUCTS . timeb . time , '(millis/1000)|0' , 'i32' ) } } } ;
1303+ // struct timeb { time_t time; unsigned short millitm; short timezone; short dstflag; };
1304+ { { { makeSetValue ( 'p' , C_STRUCTS . timeb . time , '(millis/1000)|0' , 'i64' ) } } } ;
13161305 { { { makeSetValue ( 'p' , C_STRUCTS . timeb . millitm , 'millis % 1000' , 'i16' ) } } } ;
13171306 { { { makeSetValue ( 'p' , C_STRUCTS . timeb . timezone , '0' , 'i16' ) } } } ; // Obsolete field
13181307 { { { makeSetValue ( 'p' , C_STRUCTS . timeb . dstflag , '0' , 'i16' ) } } } ; // Obsolete field
0 commit comments