File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed
Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 55 * found in the LICENSE file.
66 */
77
8- #include <emscripten/html5.h> // For `emscripten_data_now `
8+ #include <emscripten/html5.h> // For `emscripten_date_now `
99#include <time.h>
1010#include <sys/time.h>
1111
12- #include "libc.h" // For `weak`/`weak_alias`
12+ #include "libc.h" // For `weak`
1313
14-
15- time_t __time (time_t * t ) {
14+ // emscripten-specific implementations. These works out slightly smaller than
15+ // musl's since it they avoid depending on the more general clock_gettime.
16+ weak time_t time (time_t * t ) {
1617 double ret = emscripten_date_now () / 1000 ;
1718 if (t ) {
1819 * t = ret ;
1920 }
2021 return ret ;
2122}
2223
23- int __gettimeofday (struct timeval * restrict tv , void * restrict tz ) {
24+ weak int gettimeofday (struct timeval * restrict tv , void * restrict tz ) {
2425 double now_ms = emscripten_date_now ();
2526 long long now_s = now_ms / 1000 ;
2627 tv -> tv_sec = now_s ; // seconds
2728 tv -> tv_usec = (now_ms - (now_s * 1000 )) * 1000 ; // microseconds
2829 return 0 ;
2930}
3031
32+ // Non-standard glibc/BSD extension that is not implemented by musl
3133weak int dysize (int year ) {
3234 int leap = ((year % 4 == 0 ) && ((year % 100 != 0 ) || (year % 400 == 0 )));
3335 return leap ? 366 : 365 ;
3436}
35-
36- weak_alias (__time , time );
37- weak_alias (__gettimeofday , gettimeofday );
Original file line number Diff line number Diff line change 11{
22 "a.out.js" : 244691 ,
3- "a.out.nodebug.wasm" : 577706 ,
4- "total" : 822397 ,
3+ "a.out.nodebug.wasm" : 577678 ,
4+ "total" : 822369 ,
55 "sent" : [
66 " IMG_Init" ,
77 " IMG_Load" ,
17081708 " __getf2" ,
17091709 " __getitimer" ,
17101710 " __gettextdomain" ,
1711- " __gettimeofday" ,
17121711 " __gnu_f2h_ieee" ,
17131712 " __gnu_h2f_ieee" ,
17141713 " __gtdf2" ,
19091908 " __syscall_wait4" ,
19101909 " __sysv_signal" ,
19111910 " __threwValue" ,
1912- " __time" ,
19131911 " __timezone" ,
19141912 " __tolower_l" ,
19151913 " __toupper_l" ,
35753573 " $__getopt_long_core" ,
35763574 " $__getopt_msg" ,
35773575 " $__gettextdomain" ,
3578- " $__gettimeofday" ,
35793576 " $__gmtime_r" ,
35803577 " $__gnu_f2h_ieee" ,
35813578 " $__gnu_h2f_ieee" ,
37703767 " $__tan" ,
37713768 " $__tandf" ,
37723769 " $__tanl" ,
3773- " $__time" ,
37743770 " $__tolower_l" ,
37753771 " $__toread" ,
37763772 " $__toupper_l" ,
43234319 " $getsubopt" ,
43244320 " $gettext" ,
43254321 " $gettid" ,
4322+ " $gettimeofday" ,
43264323 " $getw" ,
43274324 " $getwc" ,
43284325 " $getwchar" ,
48844881 " $thrd_exit" ,
48854882 " $thrd_join" ,
48864883 " $thrd_sleep" ,
4884+ " $time" ,
48874885 " $timegm" ,
48884886 " $times" ,
48894887 " $timespec_get" ,
You can’t perform that action at this time.
0 commit comments