3 Fix build on systems where the "tv_sec" member of "struct timeval" is not
4 not of type "time_t", e.g. NetBSD/amd64 5.1.
6 --- etimedate/fl_time.cpp.orig 2005-08-31 20:50:39.000000000 +0100
7 +++ etimedate/fl_time.cpp 2011-10-11 22:57:46.000000000 +0100
10 #endif /* HAVE_STIME */
13 +my_localtime(const struct timeval *tv)
17 + return localtime(&clock);
21 Fl_Time::Fl_Time(int x, int y, int w, int h, char *l) : Fl_Group(x, y, w, h, l)
23 int button_width = (int)(w/7);
25 gettimeofday(¤t_tv, 0);
26 display_tv.tv_sec = current_tv.tv_sec;
27 display_tv.tv_usec = current_tv.tv_usec;
28 - display_time_tm = localtime(¤t_tv.tv_sec);
29 + display_time_tm = my_localtime(¤t_tv);
31 if(type() == FL_TIME_24HOUR) strftime(time_string, 19, "%2H:%2M", display_time_tm);
32 else strftime(time_string, 19, "%2I:%2M %p", display_time_tm);
34 gettimeofday(¤t_tv, 0);
36 display_tv.tv_sec = current_tv.tv_sec - different;
37 - display_time_tm = localtime(&display_tv.tv_sec);
38 + display_time_tm = my_localtime(&display_tv);
40 if(type() == FL_TIME_24HOUR) strftime(time_string, 19, "%2H:%2M", display_time_tm);
41 else strftime(time_string, 19, "%2I:%2M %p", display_time_tm);
44 struct tm *display_time_tm;
46 - display_time_tm = localtime(&display_tv.tv_sec);
47 + display_time_tm = my_localtime(&display_tv);
48 return display_time_tm->tm_hour;
53 struct tm *display_time_tm;
55 - display_time_tm = localtime(&display_tv.tv_sec);
56 + display_time_tm = my_localtime(&display_tv);
57 return display_time_tm->tm_min;
62 struct tm *display_time_tm;
64 - display_time_tm = localtime(&display_tv.tv_sec);
65 + display_time_tm = my_localtime(&display_tv);
67 if(type() == FL_TIME_24HOUR) strftime(time_string, 19, "%2H:%2M", display_time_tm);
68 else strftime(time_string, 19, "%2I:%2M %p", display_time_tm);
71 struct tm *display_time_tm;
73 - display_time_tm = localtime(&display_tv.tv_sec);
74 + display_time_tm = my_localtime(&display_tv);
75 display_time_tm->tm_hour = value;
76 display_tv.tv_sec = mktime(display_time_tm);
80 struct tm *display_time_tm;
82 - display_time_tm = localtime(&display_tv.tv_sec);
83 + display_time_tm = my_localtime(&display_tv);
86 display_time_tm->tm_min = 59;
88 void Fl_Time::settime()
90 struct tm *display_time_tm;
91 - display_time_tm = localtime(&display_tv.tv_sec);
92 + display_time_tm = my_localtime(&display_tv);
93 // return display_time_tm->tm_min;
94 time_t ct = mktime (display_time_tm);