/[gcl]/gcl/o/unixtime.c
ViewVC logotype

Diff of /gcl/o/unixtime.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by mjthomas, Fri Sep 20 00:16:34 2002 UTC revision 1.10 by mjthomas, Fri Sep 20 02:24:22 2002 UTC
# Line 50  which is usually 60 maybe 100 or somethi Line 50  which is usually 60 maybe 100 or somethi
50  #ifdef __MINGW32__  #ifdef __MINGW32__
51  #include <sys/timeb.h>  #include <sys/timeb.h>
52  int usleep ( unsigned int microseconds );  int usleep ( unsigned int microseconds );
53    void Lget_system_time_zone(void);
54  #endif  #endif
55    
56  #ifdef BSD  #ifdef BSD
# Line 150  DEFUN("GET-INTERNAL-REAL-TIME",object,fL Line 151  DEFUN("GET-INTERNAL-REAL-TIME",object,fL
151       ()       ()
152  {  {
153  #ifdef __MINGW32__  #ifdef __MINGW32__
154    static struct timeb t0;      static struct timeb t0;
155    struct timeb t;      struct timeb t;
156      if (t0.time == 0) ftime(&t0);      if (t0.time == 0) ftime(&t0);
157      ftime(&t);      ftime(&t);
158      return make_fixnum((t.time - t0.time)*HZ1 + ((t.millitm)*HZ1)/1000);      return make_fixnum((t.time - t0.time)*HZ1 + ((t.millitm)*HZ1)/1000);
# Line 174  DEFUN("GET-INTERNAL-REAL-TIME",object,fL Line 175  DEFUN("GET-INTERNAL-REAL-TIME",object,fL
175  #endif  #endif
176  }  }
177    
178    #ifdef __MINGW32__
179    DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum ( system_time_zone_helper() ),"");
180    #else
181  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum(TIME_ZONE),"");  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum(TIME_ZONE),"");
182    #endif
183    
184  void  void
185  init_unixtime(void)  init_unixtime(void)
# Line 190  init_unixtime(void) Line 195  init_unixtime(void)
195    
196          make_function("SLEEP", Lsleep);          make_function("SLEEP", Lsleep);
197          make_function("GET-INTERNAL-RUN-TIME", Lget_internal_run_time);          make_function("GET-INTERNAL-RUN-TIME", Lget_internal_run_time);
198    #ifdef __MINGW32__        
199            make_function("GET-SYSTEM-TIME-ZONE", Lget_system_time_zone);
200    #endif        
201  }  }
202    
203  #ifdef __MINGW32__  #ifdef __MINGW32__
# Line 199  int usleep ( unsigned int microseconds ) Line 207  int usleep ( unsigned int microseconds )
207      unsigned int milliseconds = microseconds / 1000;      unsigned int milliseconds = microseconds / 1000;
208      return ( SleepEx ( milliseconds, TRUE ) );      return ( SleepEx ( milliseconds, TRUE ) );
209  }  }
210    
211    int system_time_zone_helper(void)
212    {
213        TIME_ZONE_INFORMATION tzi;
214        DWORD TZResult;
215        int tz=0;
216        check_arg(0);
217        TZResult = GetTimeZoneInformation ( &tzi );
218    
219        /* Now UTC = (local time + bias), in units of minutes, so */
220        /*fprintf ( stderr, "Bias = %ld\n", tzi.Bias );*/
221        tz = (int) (tzi.Bias / 60);
222        return ( tz );                                    
223    }
224    
225    void
226    Lget_system_time_zone(void)
227    {
228        vs_push ( make_fixnum ( system_time_zone_helper() ) );
229    }
230    
231  #endif  #endif

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26