Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
wtime.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/****************************************************************************\
20wtime Neal Kettler
21\****************************************************************************/
22
23#include <ctype.h>
24#include "wtime.h"
25
26static char *DAYS[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
27
28static char *FULLDAYS[]={"Sunday","Monday","Tuesday","Wednesday","Thursday",
29 "Friday","Saturday"};
30
31static char *MONTHS[]={"Jan","Feb","Mar","Apr","May","Jun","Jul",
32 "Aug","Sep","Oct","Nov","Dec"};
33
34static char *FULLMONTHS[]={"January","February","March","April","May","June",
35 "July","August","September","October","November","December"};
36
37// MDC: Windows doesn't provide a localtime_r, so make our own...
38#ifdef _WINDOWS
39#ifdef _REENTRANT
40#include "critsec.h"
41static CritSec localtime_critsec;
42#undef localtime
43_CRTIMP struct tm *localtime(const time_t *clockval);
44#endif // _REENTRANT
45
46static struct tm *localtime_r(const time_t *clockval, struct tm *res) {
47#ifdef _REENTRANT
48 localtime_critsec.lock();
49#endif
50 struct tm *static_tm = localtime(clockval);
51 res = (struct tm *)memcpy(res, static_tm, sizeof(tm));
52#ifdef _REENTRANT
53 localtime_critsec.unlock();
54#endif
55 return res;
56}
57#endif // _WINDOWS
58
59Wtime::Wtime(void)
60{
61 Update();
62}
63
64Wtime::Wtime( Wtime &other )
65{
66 sign=other.sign;
67 sec=other.sec;
68 usec=other.usec;
69}
70
71Wtime::Wtime( uint32 other )
72{
74 sec=other;
75 usec=0;
76}
77
79{
80}
81
82void Wtime::Update(void)
83{
85 #ifdef _WINDOWS
86 struct _timeb wintime;
87 _ftime(&wintime);
88 sec=wintime.time;
89 usec=(wintime.millitm)*1000;
90 #endif
91 #ifndef _WINDOWS
92 struct timeval unixtime;
93 struct timezone unixtzone;
94 gettimeofday(&unixtime,&unixtzone);
95 sec=unixtime.tv_sec;
96 usec=unixtime.tv_usec;
97 #endif
98}
99
100
101// Parses a date string that's in modified RFC 1123 format
102// Can have a +minutes after the normal time
103// eg: Thu, 20 Jun 1996 17:33:49 +100
104// Returns true if successfully parsed, false otherwise
105bit8 Wtime::ParseDate(char *in)
106{
107 int i;
108 uint32 minOffset;
109 struct tm t;
110 char *ptr=in;
111 while ((!isgraph(*ptr))&&(*ptr!=0)) ptr++; // skip to start of string
112 if (*ptr==0) return(FALSE);
113 t.tm_wday=-1;
114 for (i=0; i<7; i++) // parse day of week
115 if (strncmp(ptr,DAYS[i],strlen(DAYS[i]))==0)
116 t.tm_wday=i;
117 if (t.tm_wday==-1)
118 return(FALSE);
119 while ((!isdigit(*ptr))&&(*ptr!=0)) ptr++; // skip to day of month
120 if (*ptr==0) return(FALSE);
121 t.tm_mday=atoi(ptr);
122 while ((!isalpha(*ptr))&&(*ptr!=0)) ptr++; // skip to month
123 if (*ptr==0) return(FALSE);
124 t.tm_mon=-1;
125 for (i=0; i<12; i++) // match month
126 if (strncmp(ptr,MONTHS[i],strlen(MONTHS[i]))==0) t.tm_mon=i;
127 if (t.tm_mon==-1) return(FALSE);
128 while ((!isdigit(*ptr))&&(*ptr!=0)) ptr++;
129 if (*ptr==0) return(FALSE);
130 t.tm_year=atoi(ptr);
131 if (t.tm_year<70) // if they specify a 2 digit year, we'll be nice
132 t.tm_year+=2000;
133 else if (t.tm_year<100)
134 t.tm_year+=1900;
135 if (t.tm_year>2200) // I doubt my code will be around for another 203 years
136 return(FALSE);
137 while ((isdigit(*ptr))&&(*ptr!=0)) ptr++; // skip to end of year
138 if (*ptr==0) return(FALSE);
139
140 while ((!isgraph(*ptr))&&(*ptr!=0)) ptr++; // skip to start of time
141 if (*ptr==0) return(FALSE);
142
143 t.tm_hour=atoi(ptr);
144 while ((*ptr!=':')&&(*ptr!=0)) ptr++;
145 ptr++; // skip past colon
146 if (*ptr==0) return(FALSE);
147 t.tm_min=atoi(ptr);
148 while ((*ptr!=':')&&(*ptr!=0)) ptr++;
149 ptr++; // skip past colon
150 if (*ptr==0) return(FALSE);
151 t.tm_sec=atoi(ptr);
152 t.tm_year%=100; // 1996 is stored as 96, not 1996
153 t.tm_isdst=-1; // daylight savings info isn't available
154
155 sec=(uint32)(mktime(&t));
156 if ((sint32)sec==-1)
157 return(FALSE);
158
159
160 // The next part of the time is OPTIONAL (+minutes)
161
162 // first skip past the seconds
163 while ((isdigit(*ptr))&&(*ptr!=0)) ptr++;
164 if (*ptr==0) return(TRUE);
165
166 // skip past any spaces
167 while ((isspace(*ptr))&&(*ptr!=0)) ptr++;
168 if (*ptr!='+')
169 {
170 //printf("\nNOPE ptr was '%s'\n",ptr);
171 return(TRUE);
172 }
173 ptr++;
174 if (*ptr==0)
175 {
176 //printf("\nPTR WAS 0\n");
177 return(TRUE);
178 }
179
180 minOffset=atol(ptr);
181 //printf("\n\nAdding %d minutes!\n\n",minOffset);
182 sec+=minOffset*60; // add the minutes as seconds
183 return(TRUE);
184}
185
186
187// This takes the standard Microsoft time formatting string
188// make sure the out string is big enough
189// An example format would be "mm/dd/yy hh:mm:ss"
190// CHANGE: Joe Howes 06/30/99
191// To specify 12-hour format, use "aa" instead of "hh".
192// The hours will be 12 hour and the string will be
193// appended with " AM" or " PM".
194bit8 Wtime::FormatTime(char *out, char *format)
195{
196 int lastWasH=0;
197 int ampmflag = 0;
198 out[0]=0;
199 char *ptr=format;
200
201 if (*ptr=='"') ptr++; // skip past open quote if exists
202
203 while (*ptr!=0)
204 {
205 if (lastWasH>0)
206 lastWasH--;
207
208 if (isspace(*ptr))
209 {
210 if (lastWasH==1) lastWasH=2;
211 sprintf(out+strlen(out),"%c",*ptr);
212 ptr+=1;
213 }
214 else if (strncmp(ptr,"\"",1)==0)
215 {
216 break;
217 }
218 else if (strncmp(ptr,":",1)==0)
219 {
220 if (lastWasH==1) lastWasH=2;
221 sprintf(out+strlen(out),":");
222 ptr+=1;
223 }
224 else if (strncmp(ptr,"/",1)==0)
225 {
226 sprintf(out+strlen(out),"/");
227 ptr+=1;
228 }
229 else if (strncmp(ptr,"c",1)==0)
230 {
231 sprintf(out+strlen(out),"%ld/%ld/%02ld %ld:%02ld:%02ld",GetMonth(),
233 ptr+=1;
234 }
235 else if (strncmp(ptr,"dddddd",6)==0)
236 {
237 sprintf(out+strlen(out),"%s %02ld, %ld",FULLMONTHS[GetMonth()-1],
238 GetMDay(),GetYear());
239 ptr+=6;
240 }
241 else if (strncmp(ptr,"ddddd",5)==0)
242 {
243 sprintf(out+strlen(out),"%ld/%ld/%02ld",GetMonth(),GetMDay(),
244 GetYear()%100);
245 ptr+=5;
246 }
247 else if (strncmp(ptr,"dddd",4)==0)
248 {
249 sprintf(out+strlen(out),"%s",FULLDAYS[GetWDay()-1]);
250 ptr+=4;
251 }
252 else if (strncmp(ptr,"ddd",3)==0)
253 {
254 sprintf(out+strlen(out),"%s",DAYS[GetWDay()-1]);
255 ptr+=3;
256 }
257 else if (strncmp(ptr,"dd",2)==0)
258 {
259 sprintf(out+strlen(out),"%02ld",GetMDay());
260 ptr+=2;
261 }
262 else if (strncmp(ptr,"d",1)==0)
263 {
264 sprintf(out+strlen(out),"%ld",GetMDay());
265 ptr+=1;
266 }
267 else if (strncmp(ptr,"ww",2)==0)
268 {
269 sprintf(out+strlen(out),"%02ld",GetYWeek());
270 ptr+=2;
271 }
272 else if (strncmp(ptr,"w",1)==0)
273 {
274 sprintf(out+strlen(out),"%ld",GetWDay());
275 ptr+=1;
276 }
277 else if (strncmp(ptr,"mmmm",4)==0)
278 {
279 sprintf(out+strlen(out),"%s",FULLMONTHS[GetMonth()-1]);
280 ptr+=4;
281 }
282 else if (strncmp(ptr,"mmm",3)==0)
283 {
284 sprintf(out+strlen(out),"%s",MONTHS[GetMonth()-1]);
285 ptr+=3;
286 }
287 else if (strncmp(ptr,"mm",2)==0)
288 {
289 if (lastWasH==1)
290 sprintf(out+strlen(out),"%02ld",GetMinute());
291 else
292 sprintf(out+strlen(out),"%02ld",GetMonth());
293 ptr+=2;
294 }
295 else if (strncmp(ptr,"m",1)==0)
296 {
297 if (lastWasH==1)
298 sprintf(out+strlen(out),"%ld",GetMinute());
299 else
300 sprintf(out+strlen(out),"%ld",GetMonth());
301 ptr+=1;
302 }
303 else if (strncmp(ptr,"q",1)==0)
304 {
305 sprintf(out+strlen(out),"%ld",((GetMonth()-1)/4)+1); // GetQuarter
306 ptr+=1;
307 }
308 else if (strncmp(ptr,"yyyy",4)==0)
309 {
310 sprintf(out+strlen(out),"%ld",GetYear());
311 ptr+=4;
312 }
313 else if (strncmp(ptr,"yy",2)==0)
314 {
315 sprintf(out+strlen(out),"%02ld",GetYear()%100);
316 ptr+=2;
317 }
318 else if (strncmp(ptr,"y",1)==0)
319 {
320 sprintf(out+strlen(out),"%ld",GetYDay());
321 ptr+=1;
322 }
323 else if (strncmp(ptr,"hh",2)==0)
324 {
325 sprintf(out+strlen(out),"%02ld",GetHour());
326 lastWasH=2; // needs to be 1 after top of loop decs it
327 ptr+=2;
328 }
329 else if (strncmp(ptr,"h",1)==0)
330 {
331 sprintf(out+strlen(out),"%ld",GetHour());
332 lastWasH=2; // needs to be 1 after top of loop decs it
333 ptr+=1;
334 }
335 else if (strncmp(ptr,"nn",2)==0)
336 {
337 sprintf(out+strlen(out),"%02ld",GetMinute());
338 ptr+=2;
339 }
340 else if (strncmp(ptr,"n",1)==0)
341 {
342 sprintf(out+strlen(out),"%ld",GetMinute());
343 ptr+=1;
344 }
345 else if (strncmp(ptr,"ss",2)==0)
346 {
347 sprintf(out+strlen(out),"%02ld",GetSecond());
348 ptr+=2;
349 }
350 else if (strncmp(ptr,"s",1)==0)
351 {
352 sprintf(out+strlen(out),"%ld",GetSecond());
353 ptr+=1;
354 }
355 else if (strncmp(ptr,"ttttt",5)==0)
356 {
357 sprintf(out+strlen(out),"%ld:%02ld:%02ld",GetHour(),GetMinute(),
358 GetSecond());
359 ptr+=5;
360 }
361 else if (strncmp(ptr,"aa",2)==0)
362 {
363 uint32 tmp = (GetHour() <= 12) ? GetHour() : GetHour() - 12;
364 sprintf(out+strlen(out),"%02ld", tmp);
365 lastWasH=2; // needs to be 1 after top of loop decs it
366 ptr+=2;
367 ampmflag = 1;
368 }
369 else // an unknown char, move to next
370 ptr++;
371 }
372 if(ampmflag)
373 {
374 char ampm[4];
375 if( GetHour() < 12 )
376 strcpy(ampm, " AM");
377 else
378 strcpy(ampm, " PM");
379 sprintf(out+strlen(out), "%s", ampm);
380 }
381 return(TRUE);
382}
383
384
385
386// In addition to PrintTime & PrintDate there is the 'Print' function
387// which prints both in RFC 1123 format
388
389void Wtime::PrintTime(FILE *out) const
390{
391 char string[80];
392 PrintTime(string);
393 fprintf(out,"%s",string);
394}
395
396void Wtime::PrintTime(char *out) const
397{
398 sprintf(out," %02lu:%02lu:%02lu",GetHour(),GetMinute(),GetSecond());
399}
400
401void Wtime::PrintDate(FILE *out) const
402{
403 char string[80];
404 PrintDate(string);
405 fprintf(out,"%s",string);
406}
407
408void Wtime::PrintDate(char *out) const
409{
410 sprintf(out,"%s, %lu %s %lu",DAYS[GetWDay()-1],GetMDay(),MONTHS[GetMonth()-1],
411 GetYear());
412}
413
414uint32 Wtime::GetSec(void) const
415{
416 return(sec);
417}
418
419uint32 Wtime::GetUsec(void) const
420{
421 return(usec);
422}
423
424void Wtime::SetSec(uint32 newsec)
425{
426 sec=newsec;
427}
428
429void Wtime::SetUsec(uint32 newusec)
430{
431 usec=newusec;
432}
433
434void Wtime::Set(uint32 newsec, uint32 newusec)
435{
436 sec=newsec;
437 usec=newusec;
438}
439
440// Get a timeval ptr from a Wtime class
441struct timeval *Wtime::GetTimeval(void)
442{
443 static struct timeval tv;
444 tv.tv_sec=sec;
445 tv.tv_usec=usec;
446 return(&tv);
447}
448
449// Get a timeval ptr from a Wtime class
450void Wtime::GetTimevalMT(struct timeval &tv)
451{
452 tv.tv_sec=sec;
453 tv.tv_usec=usec;
454}
455
456
457uint32 Wtime::GetSecond(void) const
458{
459 struct tm t;
460 struct tm *tptr;
461 tptr=localtime_r((time_t *)&sec,&t);
462 return(tptr->tm_sec);
463}
464uint32 Wtime::GetMinute(void) const
465{
466 struct tm t;
467 struct tm *tptr;
468 tptr=localtime_r((time_t *)&sec,&t);
469 return(tptr->tm_min);
470}
471uint32 Wtime::GetHour(void) const
472{
473 struct tm t;
474 struct tm *tptr;
475 tptr=localtime_r((time_t *)&sec,&t);
476 return(tptr->tm_hour);
477}
478uint32 Wtime::GetMDay(void) const
479{
480 struct tm t;
481 struct tm *tptr;
482 tptr=localtime_r((time_t *)&sec,&t);
483 return(tptr->tm_mday);
484}
485uint32 Wtime::GetWDay(void) const
486{
487 struct tm t;
488 struct tm *tptr;
489 tptr=localtime_r((time_t *)&sec,&t);
490 return(tptr->tm_wday+1);
491}
492uint32 Wtime::GetYDay(void) const
493{
494 struct tm t;
495 struct tm *tptr;
496 tptr=localtime_r((time_t *)&sec,&t);
497 return(tptr->tm_yday+1);
498}
499uint32 Wtime::GetYWeek(void) const
500{
501 uint32 yweek;
502 uint32 yday=GetYDay();
503 uint32 wday=GetWDay();
504 //phase holds the first weekday of the year. If (Jan 1 = Sun) phase = 0
505 sint32 phase=((wday-yday)%7);
506 if (phase<0) phase+=7;
507 yweek=((yday+phase-1)/7)+1;
508 return(yweek);
509}
510uint32 Wtime::GetMonth(void) const
511{
512 struct tm t;
513 struct tm *tptr;
514 tptr=localtime_r((time_t *)&sec,&t);
515 return(tptr->tm_mon+1);
516}
517
518uint32 Wtime::GetYear(void) const
519{
520 struct tm t;
521 struct tm *tptr;
522 tptr=localtime_r((time_t *)&sec,&t);
523 if ((tptr->tm_year)>=70)
524 return((tptr->tm_year)+1900);
525 else
526 return((tptr->tm_year)+2000);
527}
528
529
530bit8 Wtime::GetSign(void) const
531{
532 return(sign);
533}
534
535// 1 = *this > other
536//-1 = *this < other
537// 0 = *this == other
538int Wtime::Compare(const Wtime &other) const
539{
540 if ((sec==other.sec)&&(usec==other.usec))
541 return(0); // equal
542
543 else if (sec>other.sec)
544 return(1);
545 else if (sec<other.sec)
546 return(-1);
547 else if (usec>other.usec)
548 return(1);
549 else
550 return(-1);
551}
552
553
554bit8 Wtime::operator == ( const Wtime &other ) const
555{
556 bit8 retval=Compare(other);
557 if (retval==0)
558 return(TRUE);
559 else
560 return(FALSE);
561}
562
563bit8 Wtime::operator != ( const Wtime &other ) const
564{
565 bit8 retval=Compare(other);
566 if (retval==0)
567 return(FALSE);
568 else
569 return(TRUE);
570}
571
572bit8 Wtime::operator < ( const Wtime &other ) const
573{
574 int retval=Compare(other);
575 if (retval==-1)
576 return(TRUE);
577 else
578 return(FALSE);
579}
580
581bit8 Wtime::operator > ( const Wtime &other ) const
582{
583 int retval=Compare(other);
584 if (retval==1)
585 return(TRUE);
586 else
587 return(FALSE);
588}
589
590bit8 Wtime::operator <= ( const Wtime &other ) const
591{
592 int retval=Compare(other);
593 if ((retval==-1)||(retval==0))
594 return(TRUE);
595 else
596 return(FALSE);
597}
598
599bit8 Wtime::operator >= ( const Wtime &other ) const
600{
601 int retval=Compare(other);
602 if ((retval==1)||(retval==0))
603 return(TRUE);
604 else
605 return(FALSE);
606}
607
608
609// None of the operators pay attention to sign
610// only the functions that begin with 'Signed'
611void Wtime::SignedAdd(const Wtime &other)
612{
613 Wtime temp;
614
615 if ((sign==POSITIVE)&&(other.sign==POSITIVE))
616 {
617 *this+=other;
619 }
620 else if ((sign==POSITIVE)&&(other.sign==NEGATIVE))
621 {
622 if (*this>other)
623 {
624 *this-=other;
626 }
627 else
628 {
629 temp=other;
630 temp-=*this;
631 *this=temp;
633 }
634 }
635 else if ((sign==NEGATIVE)&&(other.sign==POSITIVE))
636 {
637 if (*this<other)
638 {
639 temp=other;
640 temp-=*this;
641 *this=temp;
643 }
644 else
645 {
646 *this-=other;
648 }
649 }
650 else if ((sign==NEGATIVE)&&(other.sign==NEGATIVE))
651 {
652 *this+=other;
654 }
655}
656
657
658
659// None of the operators pay attention to sign
660// only the functions that begin with 'Signed'
661void Wtime::SignedSubtract(const Wtime &other)
662{
663 Wtime temp;
664
665 if ((sign==POSITIVE)&&(other.sign==NEGATIVE))
666 {
667 *this+=other;
669 }
670 else if ((sign==POSITIVE)&&(other.sign==POSITIVE))
671 {
672 if (*this>other)
673 {
674 *this-=other;
676 }
677 else
678 {
679 temp=other;
680 temp-=*this;
681 *this=temp;
683 }
684 }
685 else if ((sign==NEGATIVE)&&(other.sign==NEGATIVE))
686 {
687 if (*this<other)
688 {
689 temp=other;
690 temp-=*this;
691 *this=temp;
693 }
694 else
695 {
696 *this-=other;
698 }
699 }
700 else if ((sign==NEGATIVE)&&(other.sign==POSITIVE))
701 {
702 *this+=other;
704 }
705}
706
707
708
709Wtime &Wtime::operator += (const Wtime &other)
710{
711 sec+=other.sec;
712 usec+=other.usec;
713 if (usec>1000000)
714 {
715 sec++;
716 usec-=1000000;
717 }
718 return *this;
719}
720
721Wtime &Wtime::operator -= (const Wtime &other)
722{
723 sint32 temp;
724 if (Compare(other)==-1)
725 {
726 sec=0; // can't handle negative time
727 usec=0;
728 return *this;
729 }
730 sec-=other.sec;
731 temp=(sint32)usec;
732 temp-=(sint32)other.usec;
733 if (temp<0)
734 {
735 sec--;
736 temp+=1000000;
737 }
738 usec=temp;
739 return *this;
740}
741
743{
744 Wtime temp(*this);
745 temp-=other;
746 return(temp);
747}
748
750{
751 Wtime temp(*this);
752 temp+=other;
753 return(temp);
754}
755
756
757Wtime &Wtime::operator = (const Wtime &other)
758{
759 sign=other.sign;
760 sec=other.sec;
761 usec=other.usec;
762 return *this;
763}
764
765
766Wtime &Wtime::operator += (const uint32 other)
767{
768 sec+=other;
769 return *this;
770}
771
772
773Wtime &Wtime::operator -= (const uint32 other)
774{
775 sec-=other;
776 return *this;
777}
778
779
781{
782 Wtime temp(*this);
783 temp-=other;
784 return(temp);
785}
786
787
789{
790 Wtime temp(*this);
791 temp+=other;
792 return(temp);
793}
794
795
796Wtime &Wtime::operator = (const uint32 other)
797{
799 sec=other;
800 usec=0;
801 return *this;
802}
#define TRUE
Definition BaseType.h:109
#define FALSE
Definition BaseType.h:113
char bit8
Definition wstypes.h:61
unsigned long uint32
Definition bittype.h:46
signed long sint32
Definition bittype.h:51
sint32 unlock(void) RO
Definition critsec.cpp:96
sint32 lock(int *refcount=NULL) RO
Definition critsec.cpp:52
Definition wtime.h:47
bit8 operator>=(const Wtime &other) const
Definition wtime.cpp:599
int Compare(const Wtime &other) const
Definition wtime.cpp:538
void SignedAdd(const Wtime &other)
Definition wtime.cpp:611
void SignedSubtract(const Wtime &other)
Definition wtime.cpp:661
bit8 sign
Definition wtime.h:125
struct timeval * GetTimeval(void)
Definition wtime.cpp:441
bit8 operator<(const Wtime &other) const
Definition wtime.cpp:572
void Update()
Definition wtime.cpp:82
void SetSec(uint32 newsec)
Definition wtime.cpp:424
bit8 operator!=(const Wtime &other) const
Definition wtime.cpp:563
uint32 GetSec(void) const
Definition wtime.cpp:414
Wtime operator+(Wtime &other)
Definition wtime.cpp:749
uint32 GetMinute(void) const
Definition wtime.cpp:464
uint32 sec
Definition wtime.h:123
void SetUsec(uint32 newusec)
Definition wtime.cpp:429
bit8 FormatTime(char *out, char *format)
Definition wtime.cpp:194
bit8 operator<=(const Wtime &other) const
Definition wtime.cpp:590
uint32 GetYDay(void) const
Definition wtime.cpp:492
Wtime()
Definition wtime.cpp:59
void PrintTime(FILE *out) const
Definition wtime.cpp:389
~Wtime()
Definition wtime.cpp:78
bit8 ParseDate(char *in)
Definition wtime.cpp:105
uint32 GetWDay(void) const
Definition wtime.cpp:485
uint32 GetMDay(void) const
Definition wtime.cpp:478
bit8 GetSign(void) const
Definition wtime.cpp:530
uint32 GetMonth(void) const
Definition wtime.cpp:510
void PrintDate(FILE *out) const
Definition wtime.cpp:401
uint32 usec
Definition wtime.h:124
uint32 GetSecond(void) const
Definition wtime.cpp:457
uint32 GetYear(void) const
Definition wtime.cpp:518
@ POSITIVE
Definition wtime.h:52
@ NEGATIVE
Definition wtime.h:53
Wtime & operator-=(const Wtime &other)
Definition wtime.cpp:721
Wtime operator-(Wtime &other)
Definition wtime.cpp:742
void Set(uint32 newsec, uint32 newusec)
Definition wtime.cpp:434
void GetTimevalMT(struct timeval &tv)
Definition wtime.cpp:450
uint32 GetHour(void) const
Definition wtime.cpp:471
bit8 operator>(const Wtime &other) const
Definition wtime.cpp:581
bit8 operator==(const Wtime &other) const
Definition wtime.cpp:554
uint32 GetYWeek(void) const
Definition wtime.cpp:499
Wtime & operator+=(const Wtime &other)
Definition wtime.cpp:709
Wtime & operator=(const Wtime &other)
Definition wtime.cpp:757
uint32 GetUsec(void) const
Definition wtime.cpp:419
long time_t
Definition wolapi.h:436