/[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.14 by camm, Sun Oct 27 15:35:06 2002 UTC revision 1.15 by mjthomas, Tue Nov 19 03:05:59 2002 UTC
# Line 44  which is usually 60 maybe 100 or somethi Line 44  which is usually 60 maybe 100 or somethi
44  #define HZ1 (HZ > 100 ? 100 : HZ)  #define HZ1 (HZ > 100 ? 100 : HZ)
45    
46  #ifdef USE_ATT_TIME  #ifdef USE_ATT_TIME
47  #undef BSD  #  undef BSD
48  #define ATT  #  define ATT
49  #endif  #endif
50    
51  #if defined __MINGW32__ || !defined NO_SYSTEM_TIME_ZONE  #if defined __MINGW32__ || !defined NO_SYSTEM_TIME_ZONE
52  #ifdef __MINGW32__  
53  #include <sys/timeb.h>  #  ifdef __MINGW32__
54    #    include <sys/timeb.h>
55    
56    static struct timeb t0;
57  int usleep ( unsigned int microseconds );  int usleep ( unsigned int microseconds );
58  #endif  
59    #  endif
60    
61  void siLget_system_time_zone(void);  void siLget_system_time_zone(void);
62    
63  #endif /* __MINGW32__ or  !defined NO_SYSTEM_TIME_ZONE */  #endif /* __MINGW32__ or  !defined NO_SYSTEM_TIME_ZONE */
64    
65  #ifdef BSD  #ifdef BSD
# Line 75  runtime(void) Line 82  runtime(void)
82  {  {
83    
84  #ifdef USE_INTERNAL_REAL_TIME_FOR_RUNTIME  #ifdef USE_INTERNAL_REAL_TIME_FOR_RUNTIME
85      return fLget_internal_real_time();  
86    #  ifdef __MINGW32__    
87        struct timeb t;
88        if ( t0.time == 0 ) {
89            ftime(&t0);
90        }
91        ftime ( &t );
92        return ( ( t.time - t0.time ) * HZ1 + ( (t.millitm) * HZ1 ) / 1000 );
93    #  else
94    #  error Need to return runtime without generating a fixnum (else GBC(t_fixnum) will loop)
95    #  endif
96        
97  #else    #else  
98          {          {
99            struct tms buf;            struct tms buf;
# Line 153  DEFUN("GET-INTERNAL-REAL-TIME",object,fL Line 171  DEFUN("GET-INTERNAL-REAL-TIME",object,fL
171       ()       ()
172  {  {
173  #ifdef __MINGW32__  #ifdef __MINGW32__
     static struct timeb t0;  
174      struct timeb t;      struct timeb t;
175      if (t0.time == 0) ftime(&t0);      if ( t0.time == 0 ) {
176            ftime ( &t0 );
177        }
178      ftime(&t);      ftime(&t);
179      return make_fixnum((t.time - t0.time)*HZ1 + ((t.millitm)*HZ1)/1000);      return ( make_fixnum ( ( t.time - t0.time ) * HZ1 + ( (t.millitm) * HZ1 ) / 1000 ) );
180  #endif    #endif  
181  #ifdef BSD  #ifdef BSD
182          static struct timeval begin_tzp;          static struct timeval begin_tzp;
# Line 192  init_unixtime(void) Line 211  init_unixtime(void)
211  #ifdef ATT  #ifdef ATT
212          beginning = time(0);          beginning = time(0);
213  #endif  #endif
214    #  if defined __MINGW32__
215            ftime(&t0);
216    #  endif        
217    
218          make_constant("INTERNAL-TIME-UNITS-PER-SECOND", make_fixnum(HZ1));          make_constant("INTERNAL-TIME-UNITS-PER-SECOND", make_fixnum(HZ1));
219    
# Line 226  int system_time_zone_helper(void) Line 248  int system_time_zone_helper(void)
248  #endif  #endif
249    
250  /* At GCC 3.2, Mingw struct tm does not include tm_gmtoff so avoid this version */  /* At GCC 3.2, Mingw struct tm does not include tm_gmtoff so avoid this version */
251  #if !defined NO_SYSTEM_TIME_ZONE && !defined ( __MINGW32__ )  #if !defined ( NO_SYSTEM_TIME_ZONE ) && !defined ( __MINGW32__ )
252  int system_time_zone_helper(void){  int system_time_zone_helper(void){
253        
254    struct tm *local;    struct tm *local;
# Line 243  int system_time_zone_helper(void){ Line 265  int system_time_zone_helper(void){
265  }  }
266  #endif /* !defined NO_SYSTEM_TIME_ZONE */  #endif /* !defined NO_SYSTEM_TIME_ZONE */
267    
268  #if defined __MINGW32__ || !defined NO_SYSTEM_TIME_ZONE  #if defined __MINGW32__ || !defined NO_SYSTEM_TIME_ZONE
269    
270  void  void
271  siLget_system_time_zone(void)  siLget_system_time_zone(void)
272  {  {

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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