dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / library / perforce / include / datetime.h
blobce6c8bb9c934bd154be0dca77ac0170afff5ee73
1 /*
2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
5 */
7 /*
8 * DateTime - get and set the date as a string
9 */
11 // size for Fmt, FmtDay, FmtTz
13 # define DateTimeBufSize 20
15 class DateTime {
17 public:
18 int Compare( const DateTime &t2 ) const { return tval - t2.tval; };
20 void Fmt( char *buf ) const;
21 void FmtDay( char *buf ) const;
22 void FmtTz( char *buf ) const;
23 void FmtElapsed( char *buf, const DateTime &t2 );
24 void Set( const char *date, Error *e );
25 void Set( const int date ) { tval = (time_t)date; }
26 void SetNow();
28 int Value() const { return tval; }
29 int Tomorrow() const { return tval + 24*60*60; }
30 int IsWholeDay() const { return wholeDay; }
32 // for stat() and utime() conversion
34 static time_t Localize( time_t centralTime );
35 static time_t Centralize( time_t localTime );
37 private:
38 time_t tval;
39 int wholeDay;