NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions | Variables
ncbitime.hpp File Reference

Defines: CTimeFormat - storage class for time format. More...

#include <corelib/ncbistd.hpp>
+ Include dependency graph for ncbitime.hpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  TDBTimeU
 Database format for time where day and time is unsigned 16 bit. More...
 
struct  TDBTimeI
 Database format for time where day and time is signed 32 bit. More...
 
class  CTimeFormat
 CTimeFormat –. More...
 
class  CTime
 CTime –. More...
 
struct  CTime::TData
 
class  CCurrentTime
 CCurrentTime –. More...
 
class  CTimeSpan
 CTimeSpan. More...
 
class  CTimeout
 CTimeout – Timeout interval. More...
 
class  CNanoTimeout
 CNanoTimeout – Timeout interval, using nanoseconds. More...
 
class  CDeadline
 CDeadline. More...
 
class  CFastLocalTime
 CFastLocalTime –. More...
 
class  CStopWatch
 CStopWatch –. More...
 
class  CTimeException
 CTimeException –. More...
 

Macros

#define NCBI_TIME_BITFIELD(n)   : n
 
#define NCBI_TIME_EMPTY_BITFIELD   unsigned : 0;
 

Typedefs

typedef Int8 TSeconds
 Number of seconds. More...
 
typedef struct TDBTimeUTDBTimeUPtr
 
typedef struct TDBTimeITDBTimeIPtr
 
typedef CDeadline CAbsTimeout
 

Functions

CTime GetFastLocalTime (void)
 Quick and dirty getter of local time. More...
 
void TuneupFastLocalTime (void)
 
CTime AddYear (const CTime &t, int years=1)
 
CTime AddMonth (const CTime &t, int months=1)
 
CTime AddDay (const CTime &t, int days=1)
 
CTime AddHour (const CTime &t, int hours=1)
 
CTime AddMinute (const CTime &t, int minutes=1)
 
CTime AddSecond (const CTime &t, long seconds=1)
 
CTime AddNanoSecond (const CTime &t, long nanoseconds=1)
 
CTime operator+ (const CTimeSpan &ts, const CTime &t)
 
CTime CurrentTime (CTime::ETimeZone tz=CTime::eLocal, CTime::ETimeZonePrecision tzp=CTime::eTZPrecisionDefault)
 
CTime Truncate (const CTime &t)
 
ostream & operator<< (ostream &os, const CStopWatch &sw)
 Dumps the current stopwatch time to an output stream. More...
 
ostream & operator<< (ostream &os, const CTime &t)
 Dumps the current CTime time to an output stream. More...
 

Variables

const long kNanoSecondsPerSecond = 1000000000
 Number of nanoseconds in one second. More...
 
const long kMicroSecondsPerSecond = 1000000
 Number of microseconds in one second. More...
 
const long kMilliSecondsPerSecond = 1000
 Number milliseconds in one second. More...
 
const double kAverageDaysPerYear = 365.2425
 The average length of the year in the Gregorian (modern) calendar (in days) More...
 
const TSeconds kAverageSecondsPerYear = 31556952
 The average length of the year in the Gregorian (modern) calendar (in seconds) More...
 
const TSeconds kAverageSecondsPerMonth = kAverageSecondsPerYear/12
 

Detailed Description

Defines: CTimeFormat - storage class for time format.

CTime - standard Date/Time class to represent an absolute time. CTimeSpan - class to represents a relative time span. CStopWatch - stop watch class to measure elapsed time. CTimeout - timeout interval for various I/O etc activity. CNanoTimeout - timeout interval with nanoseconds precision. CDeadline - timeout that use absolute time mark (deadline time). CFastLocalTime - class for quick and dirty getting a local time.

NOTE(s) about CTime and Time API:

1) CTime works with Gregorian calendar dates only (with some cut-off). Earlier valid date is January 1, 1583.

2) Do not use local time and time_t and its dependent functions with dates outside the range January 1, 1970 UTC to January 18, 2038 UTC. Also avoid to use universal->local time conversion functions.

3) On Windows-based computers the time zone database usually stores a single start and end rule for each zone only, regardless of year. One of the problems of this approach is that using time-zone information for some year in past will get incorrect results, if time zone rules changes since then. This affect local time only, any calculations with UTC time should be fine.

4) Do not use DataBase conversion functions for dates prior to January 1, 1900.

Definition in file ncbitime.hpp.

Modified on Fri Sep 20 14:58:08 2024 by modify_doxy.py rev. 669887