patch-dtime_c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. $OpenBSD: patch-dtime_c,v 1.3 2013/11/29 20:48:35 naddy Exp $
  2. --- dtime.c.orig Sat Sep 14 07:15:25 1991
  3. +++ dtime.c Fri Nov 29 21:38:33 2013
  4. @@ -22,17 +22,12 @@ static char rcsid[] =
  5. #ifdef SYS5
  6. extern int daylight;
  7. extern long timezone;
  8. -#else /*SYS5*/
  9. -#include <sys/timeb.h>
  10. #endif /*SYS5*/
  11. -extern long time();
  12. -struct tm* localtime();
  13. -
  14. struct tws*
  15. dtwstime()
  16. {
  17. - long clock;
  18. + time_t clock;
  19. (void) time( &clock );
  20. return dlocaltime( &clock );
  21. @@ -40,15 +35,12 @@ dtwstime()
  22. struct tws*
  23. dlocaltime( clock )
  24. - long* clock;
  25. + time_t* clock;
  26. {
  27. register struct tm* tm;
  28. -#ifndef SYS5
  29. - struct timeb tb;
  30. -#endif not SYS5
  31. static struct tws tw;
  32. - if ( clock == (long*) 0 )
  33. + if ( clock == 0 )
  34. return (struct tws*) 0;
  35. tw.tw_flags = TW_NULL;
  36. @@ -64,8 +56,7 @@ dlocaltime( clock )
  37. if ( tm->tm_isdst )
  38. tw.tw_flags |= TW_DST;
  39. #ifndef SYS5
  40. - ftime( &tb );
  41. - tw.tw_zone = -tb.timezone;
  42. + tw.tw_zone = (tm->tm_isdst ? (tm->tm_gmtoff - 3600) : tm->tm_gmtoff) / 60;
  43. #else SYS5
  44. tzset();
  45. tw.tw_zone = -( timezone / 60 );