/[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.10 by mjthomas, Fri Sep 20 02:24:22 2002 UTC revision 1.11 by prw, Sat Oct 19 05:18:32 2002 UTC
# Line 47  which is usually 60 maybe 100 or somethi Line 47  which is usually 60 maybe 100 or somethi
47  #undef BSD  #undef BSD
48  #define ATT  #define ATT
49  #endif  #endif
50    #if defined __MINGW32__ || defined __GNUC__
51  #ifdef __MINGW32__  #ifdef __MINGW32__
52  #include <sys/timeb.h>  #include <sys/timeb.h>
53  int usleep ( unsigned int microseconds );  int usleep ( unsigned int microseconds );
 void Lget_system_time_zone(void);  
54  #endif  #endif
55    void Lget_system_time_zone(void);
56    #endif /* __MINGW32__ and __GNUC__ */
57    
58  #ifdef BSD  #ifdef BSD
59  #include <time.h>  #include <time.h>
# Line 175  DEFUN("GET-INTERNAL-REAL-TIME",object,fL Line 177  DEFUN("GET-INTERNAL-REAL-TIME",object,fL
177  #endif  #endif
178  }  }
179    
180  #ifdef __MINGW32__  #if defined __MINGW32__ || defined __GNUC__
181  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum ( system_time_zone_helper() ),"");  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum ( system_time_zone_helper() ),"");
182  #else  #else
183  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum(TIME_ZONE),"");  DEFVAR("*DEFAULT-TIME-ZONE*",sSAdefault_time_zoneA,SI,make_fixnum(TIME_ZONE),"");
# Line 195  init_unixtime(void) Line 197  init_unixtime(void)
197    
198          make_function("SLEEP", Lsleep);          make_function("SLEEP", Lsleep);
199          make_function("GET-INTERNAL-RUN-TIME", Lget_internal_run_time);          make_function("GET-INTERNAL-RUN-TIME", Lget_internal_run_time);
200  #ifdef __MINGW32__          #if defined __MINGW32__   || defined __GNUC__
201          make_function("GET-SYSTEM-TIME-ZONE", Lget_system_time_zone);          make_function("GET-SYSTEM-TIME-ZONE", Lget_system_time_zone);
202  #endif          #endif        
203  }  }
# Line 213  int system_time_zone_helper(void) Line 215  int system_time_zone_helper(void)
215      TIME_ZONE_INFORMATION tzi;      TIME_ZONE_INFORMATION tzi;
216      DWORD TZResult;      DWORD TZResult;
217      int tz=0;      int tz=0;
218      check_arg(0);  
219      TZResult = GetTimeZoneInformation ( &tzi );      TZResult = GetTimeZoneInformation ( &tzi );
220    
221      /* Now UTC = (local time + bias), in units of minutes, so */      /* Now UTC = (local time + bias), in units of minutes, so */
# Line 221  int system_time_zone_helper(void) Line 223  int system_time_zone_helper(void)
223      tz = (int) (tzi.Bias / 60);      tz = (int) (tzi.Bias / 60);
224      return ( tz );                                          return ( tz );                                    
225  }  }
226    #endif
227    
228    #ifdef __GNUC__
229    int system_time_zone_helper(void){
230      
231      struct tm *local;
232      time_t TIME;
233      int nsecs;
234    
235      TIME = time(0);
236      local = localtime(&TIME);
237      nsecs = local->tm_gmtoff;
238      if (nsecs == 0)
239        return (nsecs);
240      else
241        return(- (nsecs / 60 / 60));
242    }
243    #endif /*__GNUC__*/
244    
245    #if defined __MINGW32__ || defined __GNUC__
246  void  void
247  Lget_system_time_zone(void)  Lget_system_time_zone(void)
248  {  {
249      vs_push ( make_fixnum ( system_time_zone_helper() ) );    check_arg(0);
250      vs_push ( make_fixnum ( system_time_zone_helper() ) );
251  }  }
252    
253  #endif  #endif /*__MINGW32__ and __GNUC__ */

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

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