|
LLVM
3.7.0
|
This class is used where a precise fixed point in time is required. More...
#include <TimeValue.h>
Public Types | |
Types | |
| enum | TimeConversions { NANOSECONDS_PER_SECOND = 1000000000, MICROSECONDS_PER_SECOND = 1000000, MILLISECONDS_PER_SECOND = 1000, NANOSECONDS_PER_MICROSECOND = 1000, NANOSECONDS_PER_MILLISECOND = 1000000, NANOSECONDS_PER_WIN32_TICK = 100 } |
| typedef int64_t | SecondsType |
| Type used for representing seconds. More... | |
| typedef int32_t | NanoSecondsType |
| Type used for representing nanoseconds. More... | |
Public Member Functions | |
Accessors | |
| SecondsType | seconds () const |
| Returns only the seconds component of the TimeValue. More... | |
| NanoSecondsType | nanoseconds () const |
| Returns only the nanoseconds component of the TimeValue. More... | |
| uint32_t | microseconds () const |
| Returns only the fractional portion of the TimeValue rounded down to the nearest microsecond (divide by one thousand). More... | |
| uint32_t | milliseconds () const |
| Returns only the fractional portion of the TimeValue rounded down to the nearest millisecond (divide by one million). More... | |
| uint64_t | usec () const |
| Returns the TimeValue as a number of microseconds. More... | |
| uint64_t | msec () const |
| Returns the TimeValue as a number of milliseconds. More... | |
| uint64_t | toEpochTime () const |
| Converts the TimeValue into the corresponding number of seconds since the epoch (00:00:00 Jan 1,1970). More... | |
| uint64_t | toWin32Time () const |
| Converts the TimeValue into the corresponding number of "ticks" for Win32 platforms, correcting for the difference in Win32 zero time. More... | |
| void | getTimespecTime (uint64_t &seconds, uint32_t &nanos) const |
| Provides the seconds and nanoseconds as results in its arguments after correction for the Posix zero time. More... | |
| std::string | str () const |
| Provides conversion of the TimeValue into a readable time & date. More... | |
Mutators | |
| void | seconds (SecondsType sec) |
The seconds component of the TimeValue is set to sec without modifying the nanoseconds part. More... | |
| void | nanoseconds (NanoSecondsType nanos) |
The nanoseconds component of the TimeValue is set to nanos without modifying the seconds part. More... | |
| void | microseconds (int32_t micros) |
| The seconds component remains unchanged. More... | |
| void | milliseconds (int32_t millis) |
| The seconds component remains unchanged. More... | |
| void | usec (int64_t microseconds) |
| Converts from microsecond format to TimeValue format. More... | |
| void | msec (int64_t milliseconds) |
| Converts from millisecond format to TimeValue format. More... | |
| void | fromEpochTime (SecondsType seconds) |
Converts the seconds argument from PosixTime to the corresponding TimeValue and assigns that value to this. More... | |
| void | fromWin32Time (uint64_t win32Time) |
Converts the win32Time argument from Windows FILETIME to the corresponding TimeValue and assigns that value to this. More... | |
Static Public Member Functions | |
Constants | |
| static TimeValue | MinTime () |
| A constant TimeValue representing the smallest time value permissible by the class. More... | |
| static TimeValue | MaxTime () |
| A constant TimeValue representing the largest time value permissible by the class. More... | |
| static TimeValue | ZeroTime () |
| A constant TimeValue representing the base time, or zero time of 00:00:00 (midnight) January 1st, 2000. More... | |
| static TimeValue | PosixZeroTime () |
| A constant TimeValue for the Posix base time which is 00:00:00 (midnight) January 1st, 1970. More... | |
| static TimeValue | Win32ZeroTime () |
| A constant TimeValue for the Win32 base time which is 00:00:00 (midnight) January 1st, 1601. More... | |
Constructors | |
| static TimeValue | now () |
| This is a static constructor that returns a TimeValue that represents the current time. More... | |
| TimeValue () | |
| Default construct a time value, initializing to ZeroTime. More... | |
| TimeValue (SecondsType seconds, NanoSecondsType nanos=0) | |
| Caller provides the exact value in seconds and nanoseconds. More... | |
| TimeValue (double new_time) | |
| Caller provides the exact value as a double in seconds with the fractional part representing nanoseconds. More... | |
Operators | |
| TimeValue & | operator+= (const TimeValue &that) |
Add that to this. More... | |
| TimeValue & | operator-= (const TimeValue &that) |
Subtract that from this. More... | |
| int | operator< (const TimeValue &that) const |
Determine if this is less than that. More... | |
| int | operator> (const TimeValue &that) const |
Determine if this is greather than that. More... | |
| int | operator<= (const TimeValue &that) const |
Determine if this is less than or equal to that. More... | |
| int | operator>= (const TimeValue &that) const |
Determine if this is greater than or equal to that. More... | |
| int | operator== (const TimeValue &that) const |
| Determines if two TimeValue objects represent the same moment in time. More... | |
| int | operator!= (const TimeValue &that) const |
| Determines if two TimeValue objects represent times that are not the same. More... | |
| TimeValue | operator+ (const TimeValue &tv1, const TimeValue &tv2) |
| Adds two TimeValue objects together. More... | |
| TimeValue | operator- (const TimeValue &tv1, const TimeValue &tv2) |
| Subtracts two TimeValue objects. More... | |
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.
| typedef int32_t llvm::sys::TimeValue::NanoSecondsType |
Type used for representing nanoseconds.
Definition at line 79 of file TimeValue.h.
| typedef int64_t llvm::sys::TimeValue::SecondsType |
Type used for representing seconds.
Definition at line 78 of file TimeValue.h.
Definition at line 81 of file TimeValue.h.
|
inline |
Default construct a time value, initializing to ZeroTime.
Definition at line 95 of file TimeValue.h.
Referenced by MaxTime(), MinTime(), PosixZeroTime(), Win32ZeroTime(), and ZeroTime().
|
inlineexplicit |
Caller provides the exact value in seconds and nanoseconds.
The nanos argument defaults to zero for convenience. Explicit constructor
Definition at line 100 of file TimeValue.h.
|
inlineexplicit |
Caller provides the exact value as a double in seconds with the fractional part representing nanoseconds.
Double Constructor.
Definition at line 106 of file TimeValue.h.
References NANOSECONDS_PER_SECOND.
|
inline |
Converts the seconds argument from PosixTime to the corresponding TimeValue and assigns that value to this.
Convert seconds form PosixTime to TimeValue
Definition at line 334 of file TimeValue.h.
Referenced by llvm::object::ArchiveMemberHeader::getLastModified(), now(), and llvm::writeArchive().
|
inline |
Converts the win32Time argument from Windows FILETIME to the corresponding TimeValue and assigns that value to this.
Convert seconds form Windows FILETIME to TimeValue
Definition at line 343 of file TimeValue.h.
|
inline |
Provides the seconds and nanoseconds as results in its arguments after correction for the Posix zero time.
Convert to timespec time (ala POSIX.1b)
Definition at line 267 of file TimeValue.h.
|
inlinestatic |
A constant TimeValue representing the largest time value permissible by the class.
MaxTime is some point in the distant future, about 300 billion years AD. The largest possible time value.
Definition at line 49 of file TimeValue.h.
References TimeValue().
|
inline |
Returns only the fractional portion of the TimeValue rounded down to the nearest microsecond (divide by one thousand).
Retrieve the fractional part as microseconds;
Definition at line 217 of file TimeValue.h.
References NANOSECONDS_PER_MICROSECOND.
Referenced by llvm::TimeRecord::getCurrentTime().
|
inline |
The seconds component remains unchanged.
Set the nanoseconds component using a number of microseconds.
Definition at line 303 of file TimeValue.h.
References NANOSECONDS_PER_MICROSECOND.
|
inline |
Returns only the fractional portion of the TimeValue rounded down to the nearest millisecond (divide by one million).
Retrieve the fractional part as milliseconds;
Definition at line 224 of file TimeValue.h.
References NANOSECONDS_PER_MILLISECOND.
|
inline |
The seconds component remains unchanged.
Set the nanoseconds component using a number of milliseconds.
Definition at line 310 of file TimeValue.h.
References NANOSECONDS_PER_MILLISECOND.
|
inlinestatic |
A constant TimeValue representing the smallest time value permissible by the class.
MinTime is some point in the distant past, about 300 billion years BCE. The smallest possible time value.
Definition at line 41 of file TimeValue.h.
References TimeValue().
|
inline |
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. Convert to a number of milliseconds (can overflow)
Definition at line 243 of file TimeValue.h.
References MILLISECONDS_PER_SECOND, and NANOSECONDS_PER_MILLISECOND.
|
inline |
Converts from millisecond format to TimeValue format.
Definition at line 324 of file TimeValue.h.
References MILLISECONDS_PER_SECOND, and NANOSECONDS_PER_MILLISECOND.
|
inline |
Returns only the nanoseconds component of the TimeValue.
The seconds portion is ignored. Retrieve the nanoseconds component.
Definition at line 212 of file TimeValue.h.
|
inline |
The nanoseconds component of the TimeValue is set to nanos without modifying the seconds part.
This is useful for basic computations involving just the nanoseconds portion. Note that the TimeValue will be normalized after this call so that the fractional (nanoseconds) portion will have the smallest equivalent value. Set the nanoseconds component using a number of nanoseconds.
Definition at line 296 of file TimeValue.h.
|
static |
This is a static constructor that returns a TimeValue that represents the current time.
Creates a TimeValue with the current time (UTC).
Referenced by llvm::PMDataManager::dumpPassInfo(), and now().
Determines if two TimeValue objects represent times that are not the same.
Definition at line 187 of file TimeValue.h.
Add that to this.
Definition at line 127 of file TimeValue.h.
Subtract that from this.
Definition at line 137 of file TimeValue.h.
Determine if this is less than that.
Definition at line 147 of file TimeValue.h.
Determine if this is less than or equal to that.
Definition at line 164 of file TimeValue.h.
Determines if two TimeValue objects represent the same moment in time.
Definition at line 179 of file TimeValue.h.
Determine if this is greather than that.
Definition at line 152 of file TimeValue.h.
Determine if this is greater than or equal to that.
Definition at line 168 of file TimeValue.h.
|
inlinestatic |
A constant TimeValue for the Posix base time which is 00:00:00 (midnight) January 1st, 1970.
00:00:00 Jan 1, 1970 UTC.
Definition at line 63 of file TimeValue.h.
References TimeValue().
|
inline |
Returns only the seconds component of the TimeValue.
The nanoseconds portion is ignored. No rounding is performed. Retrieve the seconds component
Definition at line 207 of file TimeValue.h.
Referenced by llvm::TimeRecord::getCurrentTime().
|
inline |
The seconds component of the TimeValue is set to sec without modifying the nanoseconds part.
This is useful for whole second arithmetic. Set the seconds component.
Definition at line 285 of file TimeValue.h.
| std::string llvm::sys::TimeValue::str | ( | ) | const |
Provides conversion of the TimeValue into a readable time & date.
Referenced by llvm::PMDataManager::dumpPassInfo().
|
inline |
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.
Referenced by printRestOfMemberHeader().
|
inline |
Converts the TimeValue into the corresponding number of "ticks" for Win32 platforms, correcting for the difference in Win32 zero time.
Convert to Win32's FILETIME (100ns intervals since 00:00:00 Jan 1, 1601 UTC)
Definition at line 258 of file TimeValue.h.
References NANOSECONDS_PER_WIN32_TICK.
|
inline |
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. Convert to a number of microseconds (can overflow)
Definition at line 233 of file TimeValue.h.
References MICROSECONDS_PER_SECOND, and NANOSECONDS_PER_MICROSECOND.
|
inline |
Converts from microsecond format to TimeValue format.
Definition at line 316 of file TimeValue.h.
References MICROSECONDS_PER_SECOND, and NANOSECONDS_PER_MICROSECOND.
|
inlinestatic |
A constant TimeValue for the Win32 base time which is 00:00:00 (midnight) January 1st, 1601.
00:00:00 Jan 1, 1601 UTC.
Definition at line 70 of file TimeValue.h.
References TimeValue().
|
inlinestatic |
A constant TimeValue representing the base time, or zero time of 00:00:00 (midnight) January 1st, 2000.
00:00:00 Jan 1, 2000 UTC.
Definition at line 56 of file TimeValue.h.
References TimeValue().
Adds two TimeValue objects together.
Definition at line 371 of file TimeValue.h.
Subtracts two TimeValue objects.
Definition at line 377 of file TimeValue.h.
1.8.6