@@ -34,48 +34,6 @@ weak time_t __time(time_t *t) {
3434static  thread_local bool  checked_monotonic  =  false;
3535static  thread_local bool  is_monotonic  =  0 ;
3636
37- weak  int  __clock_gettime (clockid_t  clk , struct  timespec  * ts ) {
38-   if  (!checked_monotonic ) {
39-     is_monotonic  =  _emscripten_get_now_is_monotonic ();
40-     checked_monotonic  =  true;
41-   }
42- 
43-   double  now_ms ;
44-   if  (clk  ==  CLOCK_REALTIME ) {
45-     now_ms  =  emscripten_date_now ();
46-   } else  if  ((clk  ==  CLOCK_MONOTONIC  ||  clk  ==  CLOCK_MONOTONIC_RAW ) &&  is_monotonic ) {
47-     now_ms  =  emscripten_get_now ();
48-   } else  {
49-     errno  =  EINVAL ;
50-     return  -1 ;
51-   }
52- 
53-   long long  now_s  =  now_ms  / 1000 ;
54-   ts -> tv_sec  =  now_s ; // seconds 
55-   ts -> tv_nsec  =  (now_ms  -  (now_s  *  1000 )) *  1000  *  1000 ; // nanoseconds 
56-   return  0 ;
57- }
58- 
59- weak  int  __clock_getres (clockid_t  clk , struct  timespec  * ts ) {
60-   if  (!checked_monotonic ) {
61-     is_monotonic  =  _emscripten_get_now_is_monotonic ();
62-     checked_monotonic  =  true;
63-   }
64- 
65-   double  nsec ;
66-   if  (clk  ==  CLOCK_REALTIME ) {
67-     nsec  =  1000  *  1000 ; // educated guess that it's milliseconds 
68-   } else  if  (clk  ==  CLOCK_MONOTONIC  &&  is_monotonic ) {
69-     nsec  =  emscripten_get_now_res ();
70-   } else  {
71-     errno  =  EINVAL ;
72-     return  -1 ;
73-   }
74-   ts -> tv_sec  =  (nsec  / (1000  *  1000  *  1000 ));
75-   ts -> tv_nsec  =  nsec ;
76-   return  0 ;
77- }
78- 
7937weak  int  __gettimeofday (struct  timeval  * restrict tv , void  * restrict tz ) {
8038  double  now_ms  =  emscripten_date_now ();
8139  long long  now_s  =  now_ms  / 1000 ;
@@ -91,6 +49,4 @@ weak int dysize(int year) {
9149
9250weak_alias (__time , time );
9351weak_alias (__clock , clock );
94- weak_alias (__clock_gettime , clock_gettime );
95- weak_alias (__clock_getres , clock_getres );
9652weak_alias (__gettimeofday , gettimeofday );
0 commit comments