LLVM API Documentation
#include <TimeValue.h>
Collaboration diagram for llvm::sys::TimeValue:
Constructors | |
TimeValue (SecondsType seconds, NanoSecondsType nanos=0) | |
Explicit constructor. | |
TimeValue (double new_time) | |
Double Constructor. | |
static TimeValue | now () |
Creates a TimeValue with the current time (UTC). | |
Operators | |
TimeValue & | operator+= (const TimeValue &that) |
Incrementing assignment operator. | |
TimeValue & | operator-= (const TimeValue &that) |
Decrementing assignment operator. | |
int | operator< (const TimeValue &that) const |
True if this < that. | |
int | operator> (const TimeValue &that) const |
True if this > that. | |
int | operator<= (const TimeValue &that) const |
True if this <= that. | |
int | operator>= (const TimeValue &that) const |
True if this >= that. | |
int | operator== (const TimeValue &that) const |
True iff *this == that. True if this == that. | |
int | operator!= (const TimeValue &that) const |
True if this != that. | |
TimeValue | operator+ (const TimeValue &tv1, const TimeValue &tv2) |
Addition operator. | |
TimeValue | operator- (const TimeValue &tv1, const TimeValue &tv2) |
Subtraction operator. | |
Public Types | |
Types | |
typedef int64_t | SecondsType |
Type used for representing seconds. | |
typedef int32_t | NanoSecondsType |
Type used for representing nanoseconds. | |
enum | TimeConversions { NANOSECONDS_PER_SECOND = 1000000000, MICROSECONDS_PER_SECOND = 1000000, MILLISECONDS_PER_SECOND = 1000, NANOSECONDS_PER_MICROSECOND = 1000, NANOSECONDS_PER_MILLISECOND = 1000000, NANOSECONDS_PER_POSIX_TICK = 100, NANOSECONDS_PER_WIN32_TICK = 100 } |
Public Member Functions | |
Accessors | |
SecondsType | seconds () const |
Retrieve the seconds component. | |
NanoSecondsType | nanoseconds () const |
Retrieve the nanoseconds component. | |
uint32_t | microseconds () const |
Retrieve the fractional part as microseconds;. | |
uint32_t | milliseconds () const |
Retrieve the fractional part as milliseconds;. | |
uint64_t | usec () const |
Convert to a number of microseconds (can overflow). | |
uint64_t | msec () const |
Convert to a number of milliseconds (can overflow). | |
uint64_t | toPosixTime () const |
Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970). | |
uint64_t | toEpochTime () const |
uint64_t | toWin32Time () const |
Convert to windows time (seconds since 12:00:00a Jan 1, 1601). | |
void | getTimespecTime (uint64_t &seconds, uint32_t &nanos) const |
Convert to timespec time (ala POSIX.1b). | |
std::string | toString () const |
Convert time to a string. | |
Mutators | |
void | seconds (SecondsType sec) |
Set the seconds component. | |
void | nanoseconds (NanoSecondsType nanos) |
Set the nanoseconds component using a number of nanoseconds. | |
void | microseconds (int32_t micros) |
Set the nanoseconds component using a number of microseconds. | |
void | milliseconds (int32_t millis) |
Set the nanoseconds component using a number of milliseconds. | |
void | usec (int64_t microseconds) |
Converts from microsecond format to TimeValue format. | |
void | msec (int64_t milliseconds) |
Converts from millisecond format to TimeValue format. | |
void | fromEpochTime (SecondsType seconds) |
Convert seconds form PosixTime to TimeValue. | |
Static Public Attributes | |
Constants | |
static const TimeValue | MinTime = TimeValue ( INT64_MIN,0 ) |
The smallest possible time value. | |
static const TimeValue | MaxTime = TimeValue ( INT64_MAX,0 ) |
The largest possible time value. | |
static const TimeValue | ZeroTime = TimeValue ( 0,0 ) |
00:00:00 Jan 1, 2000 UTC. | |
static const TimeValue | PosixZeroTime = TimeValue ( -946684800,0 ) |
00:00:00 Jan 1, 1970 UTC. | |
static const TimeValue | Win32ZeroTime = TimeValue ( -12591158400ULL,0 ) |
00:00:00 Jan 1, 1601 UTC. |
This class is used where a precise fixed point in time is required. The range of TimeValue spans many hundreds of billions of years both past and present. The precision of TimeValue is to the nanosecond. However, the actual precision of its values will be determined by the resolution of the system clock. The TimeValue class is used in conjunction with several other lib/System interfaces to specify the time at which a call should timeout, etc.
Definition at line 31 of file TimeValue.h.
|
Type used for representing nanoseconds.
Definition at line 69 of file TimeValue.h. |
|
Type used for representing seconds.
Definition at line 68 of file TimeValue.h. |
|
Definition at line 71 of file TimeValue.h. |
|
Explicit constructor.
Caller provides the exact value in seconds and nanoseconds. The Definition at line 88 of file TimeValue.h. Referenced by now(). |
|
Double Constructor. Caller provides the exact value as a double in seconds with the fractional part representing nanoseconds. Definition at line 94 of file TimeValue.h. References NANOSECONDS_PER_SECOND. |
|
Convert seconds form PosixTime to TimeValue.
Converts the Definition at line 333 of file TimeValue.h. References PosixZeroTime, and seconds_. Referenced by llvm::sys::Path::getStatusInfo(), and llvm::Archive::parseMemberHeader(). |
|
Convert to timespec time (ala POSIX.1b). Provides the seconds and nanoseconds as results in its arguments after correction for the Posix zero time. Definition at line 266 of file TimeValue.h. References PosixZeroTime, and seconds_. |
|
Set the nanoseconds component using a number of microseconds. The seconds component remains unchanged. Definition at line 302 of file TimeValue.h. References NANOSECONDS_PER_MICROSECOND. |
|
Retrieve the fractional part as microseconds;. Returns only the fractional portion of the TimeValue rounded down to the nearest microsecond (divide by one thousand). Definition at line 208 of file TimeValue.h. References NANOSECONDS_PER_MICROSECOND. |
|
Set the nanoseconds component using a number of milliseconds. The seconds component remains unchanged. Definition at line 309 of file TimeValue.h. References NANOSECONDS_PER_MILLISECOND. |
|
Retrieve the fractional part as milliseconds;. Returns only the fractional portion of the TimeValue rounded down to the nearest millisecond (divide by one million). Definition at line 215 of file TimeValue.h. References NANOSECONDS_PER_MILLISECOND. |
|
Converts from millisecond format to TimeValue format.
Definition at line 323 of file TimeValue.h. References MILLISECONDS_PER_SECOND, and NANOSECONDS_PER_MILLISECOND. |
|
Convert to a number of milliseconds (can overflow). Returns the TimeValue as a number of milliseconds. Note that the value returned can overflow because the range of a uint64_t is smaller than the range of a TimeValue. Nevertheless, this is useful on some operating systems and is therefore provided. Definition at line 234 of file TimeValue.h. References MILLISECONDS_PER_SECOND, and NANOSECONDS_PER_MILLISECOND. |
|
Set the nanoseconds component using a number of nanoseconds.
The nanoseconds component of the TimeValue is set to Definition at line 295 of file TimeValue.h. |
|
Retrieve the nanoseconds component. Returns only the nanoseconds component of the TimeValue. The seconds portion is ignored. Definition at line 203 of file TimeValue.h. |
|
Creates a TimeValue with the current time (UTC). This is a static constructor that returns a TimeValue that represents the current time. Definition at line 38 of file Unix/TimeValue.cpp. References NANOSECONDS_PER_MICROSECOND, ThrowErrno(), and TimeValue(). Referenced by llvm::ArchiveMember::ArchiveMember(), and llvm::Archive::writeSymbolTable(). |
|
True if this != that. Determines if two TimeValue objects represent times that are not the same.
Definition at line 178 of file TimeValue.h. |
|
Incrementing assignment operator.
Add
Definition at line 115 of file TimeValue.h. |
|
Decrementing assignment operator.
Subtract
Definition at line 125 of file TimeValue.h. |
|
True if this < that.
Determine if
Definition at line 135 of file TimeValue.h. |
|
True if this <= that.
Determine if
Definition at line 152 of file TimeValue.h. |
|
True iff *this == that. True if this == that. Determines if two TimeValue objects represent the same moment in time. Definition at line 169 of file TimeValue.h. |
|
True if this > that.
Determine if
Definition at line 140 of file TimeValue.h. |
|
True if this >= that.
Determine if
Definition at line 157 of file TimeValue.h. |
|
Set the seconds component.
The seconds component of the TimeValue is set to Definition at line 284 of file TimeValue.h. |
|
Retrieve the seconds component. Returns only the seconds component of the TimeValue. The nanoseconds portion is ignored. No rounding is performed. Definition at line 198 of file TimeValue.h. |
|
Converts the TimeValue into the corresponding number of seconds since the epoch (00:00:00 Jan 1,1970). Definition at line 250 of file TimeValue.h. References PosixZeroTime, and seconds_. Referenced by llvm::Archive::fillHeader(), and llvm::Archive::writeSymbolTable(). |
|
Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970). Converts the TimeValue into the corresponding number of "ticks" for Posix, correcting for the difference in Posix zero time. Definition at line 242 of file TimeValue.h. References NANOSECONDS_PER_POSIX_TICK, PosixZeroTime, and seconds_. Referenced by llvm::sys::Path::setStatusInfo(). |
|
Convert time to a string. Provides conversion of the TimeValue into a readable time & date.
Definition at line 28 of file Unix/TimeValue.cpp. |
|
Convert to windows time (seconds since 12:00:00a Jan 1, 1601). Converts the TiemValue into the correspodning number of "ticks" for Win32 platforms, correcting for the difference in Win32 zero time. Definition at line 257 of file TimeValue.h. References NANOSECONDS_PER_WIN32_TICK, seconds_, and Win32ZeroTime. |
|
Converts from microsecond format to TimeValue format.
Definition at line 315 of file TimeValue.h. References MICROSECONDS_PER_SECOND, and NANOSECONDS_PER_MICROSECOND. |
|
Convert to a number of microseconds (can overflow). Returns the TimeValue as a number of microseconds. Note that the value returned can overflow because the range of a uint64_t is smaller than the range of a TimeValue. Nevertheless, this is useful on some operating systems and is therefore provided. Definition at line 224 of file TimeValue.h. References MICROSECONDS_PER_SECOND, and NANOSECONDS_PER_MICROSECOND. |
|
Addition operator. Adds two TimeValue objects together.
Definition at line 360 of file TimeValue.h. |
|
Subtraction operator. Subtracts two TimeValue objects.
Definition at line 366 of file TimeValue.h. |
|
The largest possible time value. A constant TimeValue representing the largest time value permissable by the class. MaxTime is some point in the distant future, about 300 billion years AD. Definition at line 20 of file TimeValue.cpp. |
|
The smallest possible time value. A constant TimeValue representing the smallest time value permissable by the class. MinTime is some point in the distant past, about 300 billion years BCE. Definition at line 19 of file TimeValue.cpp. |
|
00:00:00 Jan 1, 1970 UTC. A constant TimeValue for the Posix base time which is 00:00:00 (midnight) January 1st, 1970. Definition at line 22 of file TimeValue.cpp. Referenced by fromEpochTime(), getTimespecTime(), toEpochTime(), and toPosixTime(). |
|
00:00:00 Jan 1, 1601 UTC. A constant TimeValue for the Win32 base time which is 00:00:00 (midnight) January 1st, 1601. Definition at line 23 of file TimeValue.cpp. Referenced by toWin32Time(). |
|
00:00:00 Jan 1, 2000 UTC. A constant TimeValue representing the base time, or zero time of 00:00:00 (midnight) January 1st, 2000. Definition at line 21 of file TimeValue.cpp. |