LibreOffice Module tools (master) 1
|
#include <time.hxx>
Public Types | |
enum | TimeInitSystem { SYSTEM } |
enum | TimeInitEmpty { EMPTY } |
Public Member Functions | |
Time (TimeInitEmpty) | |
Time (TimeInitSystem) | |
Time (sal_Int64 _nTime) | |
Time (const tools::Time &rTime) | |
Time (const css::util::Time &rTime) | |
Time (const css::util::DateTime &rDateTime) | |
Time (sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec=0, sal_uInt64 nNanoSec=0) | |
void | SetTime (sal_Int64 nNewTime) |
sal_Int64 | GetTime () const |
css::util::Time | GetUNOTime () const |
void | SetHour (sal_uInt16 nNewHour) |
void | SetMin (sal_uInt16 nNewMin) |
void | SetSec (sal_uInt16 nNewSec) |
void | SetNanoSec (sal_uInt32 nNewNanoSec) |
sal_uInt16 | GetHour () const |
sal_uInt16 | GetMin () const |
sal_uInt16 | GetSec () const |
sal_uInt32 | GetNanoSec () const |
sal_Int32 | GetMSFromTime () const |
void | MakeTimeFromMS (sal_Int32 nMS) |
sal_Int64 | GetNSFromTime () const |
void | MakeTimeFromNS (sal_Int64 nNS) |
double | GetTimeInDays () const |
12 hours == 0.5 days More... | |
bool | IsEqualIgnoreNanoSec (const tools::Time &rTime) const |
bool | operator== (const tools::Time &rTime) const |
bool | operator!= (const tools::Time &rTime) const |
bool | operator> (const tools::Time &rTime) const |
bool | operator< (const tools::Time &rTime) const |
bool | operator>= (const tools::Time &rTime) const |
bool | operator<= (const tools::Time &rTime) const |
tools::Time & | operator= (const tools::Time &rTime) |
Time | operator- () const |
tools::Time & | operator+= (const tools::Time &rTime) |
tools::Time & | operator-= (const tools::Time &rTime) |
Static Public Member Functions | |
static void | GetClock (double fTimeInDays, sal_uInt16 &nHour, sal_uInt16 &nMinute, sal_uInt16 &nSecond, double &fFractionOfSecond, int nFractionDecimals) |
Get the wall clock time particles for a (date+)time value. More... | |
static Time | GetUTCOffset () |
static sal_uInt64 | GetSystemTicks () |
Elapsed time in milliseconds (1e-3) since some unspecified starting point. More... | |
static sal_uInt64 | GetMonotonicTicks () |
Elapsed time in microseconds (1e-6) since some unspecified starting point. More... | |
Static Public Attributes | |
static const sal_Int64 | hourPerDay = 24 |
static const sal_Int64 | minutePerHour = 60 |
static const sal_Int64 | secondPerMinute = 60 |
static const sal_Int64 | nanoSecPerSec = 1000000000 |
static const sal_Int64 | nanoSecPerMinute = nanoSecPerSec * secondPerMinute |
static const sal_Int64 | nanoSecPerHour = nanoSecPerSec * secondPerMinute * minutePerHour |
static const sal_Int64 | nanoSecPerDay = nanoSecPerSec * secondPerMinute * minutePerHour * hourPerDay |
static const sal_Int64 | secondPerHour = secondPerMinute * minutePerHour |
static const sal_Int64 | secondPerDay = secondPerMinute * minutePerHour * hourPerDay |
static const sal_Int64 | minutePerDay = minutePerHour * hourPerDay |
static const sal_Int64 | nanoPerMicro = 1000 |
static const sal_Int64 | nanoPerMilli = 1000000 |
static const sal_Int64 | nanoPerCenti = 10000000 |
Private Member Functions | |
void | init (sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec, sal_uInt64 nNanoSec) |
Private Attributes | |
sal_Int64 | nTime |
Friends | |
TOOLS_DLLPUBLIC friend Time | operator+ (const tools::Time &rTime1, const tools::Time &rTime2) |
TOOLS_DLLPUBLIC friend Time | operator- (const tools::Time &rTime1, const tools::Time &rTime2) |
|
inlineexplicit |
Definition at line 67 of file time.hxx.
Referenced by DateTime::NormalizeTimeRemainderAndApply(), and DateTime::operator=().
|
explicit |
Definition at line 94 of file ttime.cxx.
References GetSystemDateTime(), and nTime.
|
inlineexplicit |
tools::Time::Time | ( | const tools::Time & | rTime | ) |
tools::Time::Time | ( | const css::util::Time & | rTime | ) |
|
explicit |
tools::Time::Time | ( | sal_uInt32 | nHour, |
sal_uInt32 | nMin, | ||
sal_uInt32 | nSec = 0 , |
||
sal_uInt64 | nNanoSec = 0 |
||
) |
|
static |
Get the wall clock time particles for a (date+)time value.
Does the necessary rounding and truncating to obtain hour, minute, second and fraction of second from a double time value (time in days, 0.5 == 12h) such that individual values are not rounded up, i.e. x:59:59.999 does not yield x+1:0:0.00
A potential date component (fTimeInDays >= 1.0) is discarded.
nFractionDecimals | If > 0 fFractionOfSecond is truncated to that amount of decimals. Else fFractionOfSecond returns the full remainder of the fractional second. |
Definition at line 286 of file ttime.cxx.
References secondPerDay, secondPerHour, and secondPerMinute.
|
inline |
Definition at line 85 of file time.hxx.
Referenced by DateTimeToOString(), tools::Duration::Duration(), DateTime::GetSecFromDateTime(), DateTime::GetUNODateTime(), tools::Duration::Mult(), and DateTime::NormalizeTimeRemainderAndApply().
|
inline |
Definition at line 88 of file time.hxx.
Referenced by DateTimeToOString(), tools::Duration::Duration(), DateTime::GetSecFromDateTime(), DateTime::GetUNODateTime(), and tools::Duration::Mult().
|
static |
Elapsed time in microseconds (1e-6) since some unspecified starting point.
Uses the high-precision, monotonic time sources provided by the OS, if available. Don't try to relate it to the system time, and also it's long time accuracy is not the best.
Currently used to measure the runtime of OpenCL shaders and to set a message creation timestamp to allow filtering of invalid timer messages.
Definition at line 466 of file ttime.cxx.
Referenced by GetSystemTicks().
|
inline |
Definition at line 94 of file time.hxx.
Referenced by tools::Duration::Duration(), DateTime::GetUNODateTime(), IsEqualIgnoreNanoSec(), and tools::Duration::Mult().
sal_Int64 tools::Time::GetNSFromTime | ( | ) | const |
Definition at line 212 of file ttime.cxx.
Referenced by tools::Duration::Add(), DateTime::GetWin32FileDateTime(), tools::Duration::Mult(), and tools::Duration::SetTimeDiff().
|
inline |
Definition at line 91 of file time.hxx.
Referenced by DateTimeToOString(), tools::Duration::Duration(), DateTime::GetSecFromDateTime(), DateTime::GetUNODateTime(), and tools::Duration::Mult().
|
static |
Elapsed time in milliseconds (1e-3) since some unspecified starting point.
Convenience function, which just calls GetMonotonicTicks() / 1000.
Definition at line 451 of file ttime.cxx.
References GetMonotonicTicks().
Referenced by GetUTCOffset().
|
inline |
Definition at line 78 of file time.hxx.
Referenced by tools::Duration::ApplyTime(), tools::Duration::Duration(), MakeTimeFromMS(), MakeTimeFromNS(), tools::Duration::Mult(), tools::Duration::Normalize(), DateTime::NormalizeTimeRemainderAndApply(), operator+=(), tools::Duration::operator-(), and operator-=().
double tools::Time::GetTimeInDays | ( | ) | const |
|
static |
Definition at line 396 of file ttime.cxx.
References abs(), GetSystemTicks(), and tm.
Referenced by DateTime::ConvertToLocalTime(), and DateTime::ConvertToUTC().
|
private |
bool tools::Time::IsEqualIgnoreNanoSec | ( | const tools::Time & | rTime | ) | const |
Definition at line 389 of file ttime.cxx.
References GetNanoSec(), n1, n2, and nTime.
Referenced by DateTime::IsEqualIgnoreNanoSec().
void tools::Time::MakeTimeFromMS | ( | sal_Int32 | nMS | ) |
void tools::Time::MakeTimeFromNS | ( | sal_Int64 | nNS | ) |
Definition at line 227 of file ttime.cxx.
References GetTime().
Referenced by tools::Duration::ApplyTime(), and tools::Duration::Duration().
|
inline |
Time & tools::Time::operator+= | ( | const tools::Time & | rTime | ) |
Time & tools::Time::operator-= | ( | const tools::Time & | rTime | ) |
|
inline |
|
inline |
Time & tools::Time::operator= | ( | const tools::Time & | rTime | ) |
Definition at line 357 of file ttime.cxx.
References nTime.
Referenced by DateTime::NormalizeTimeRemainderAndApply().
|
inline |
|
inline |
|
inline |
void tools::Time::SetHour | ( | sal_uInt16 | nNewHour | ) |
Definition at line 147 of file ttime.cxx.
References HOUR_MASK, MIN_MASK, and SEC_MASK.
Referenced by tools::Duration::Duration(), and DateTime::NormalizeTimeRemainderAndApply().
void tools::Time::SetMin | ( | sal_uInt16 | nNewMin | ) |
void tools::Time::SetNanoSec | ( | sal_uInt32 | nNewNanoSec | ) |
void tools::Time::SetSec | ( | sal_uInt16 | nNewSec | ) |
|
inline |
Definition at line 77 of file time.hxx.
Referenced by DateTime::DateTime().
|
friend |
|
friend |
|
static |
Definition at line 53 of file time.hxx.
Referenced by tools::Duration::Mult(), and tools::Duration::Normalize().
|
static |
|
static |
Definition at line 54 of file time.hxx.
Referenced by tools::Duration::Mult(), and tools::Duration::Normalize().
|
static |
Definition at line 59 of file time.hxx.
Referenced by tools::Duration::Add(), tools::Duration::ApplyTime(), DateTime::CreateFromUnixTime(), tools::Duration::Duration(), and tools::Duration::Mult().
|
static |
Definition at line 58 of file time.hxx.
Referenced by DateTime::CreateFromUnixTime(), and DateTime::CreateFromWin32FileDateTime().
|
static |
Definition at line 57 of file time.hxx.
Referenced by DateTime::CreateFromUnixTime(), and DateTime::CreateFromWin32FileDateTime().
|
static |
Definition at line 56 of file time.hxx.
Referenced by DateTime::CreateFromUnixTime(), DateTime::CreateFromWin32FileDateTime(), tools::Duration::Duration(), tools::Duration::Mult(), and tools::Duration::Normalize().
|
private |
Definition at line 38 of file time.hxx.
Referenced by IsEqualIgnoreNanoSec(), operator!=(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), and Time().
|
static |
Definition at line 61 of file time.hxx.
Referenced by GetClock().
|
static |
Definition at line 60 of file time.hxx.
Referenced by GetClock().
|
static |
Definition at line 55 of file time.hxx.
Referenced by GetClock(), tools::Duration::Mult(), and tools::Duration::Normalize().