19#ifndef INCLUDED_TOOLS_TIME_HXX
20#define INCLUDED_TOOLS_TIME_HXX
23#include <com/sun/star/util/Time.hpp>
39 void init( sal_uInt32 nHour, sal_uInt32 nMin,
40 sal_uInt32 nSec, sal_uInt64 nNanoSec);
53 static const sal_Int64 hourPerDay = 24;
54 static const sal_Int64 minutePerHour = 60;
55 static const sal_Int64 secondPerMinute = 60;
56 static const sal_Int64 nanoSecPerSec = 1000000000;
57 static const sal_Int64 nanoSecPerMinute = nanoSecPerSec * secondPerMinute;
58 static const sal_Int64 nanoSecPerHour = nanoSecPerSec * secondPerMinute * minutePerHour;
59 static const sal_Int64 nanoSecPerDay = nanoSecPerSec * secondPerMinute * minutePerHour * hourPerDay;
60 static const sal_Int64 secondPerHour = secondPerMinute * minutePerHour;
61 static const sal_Int64 secondPerDay = secondPerMinute * minutePerHour * hourPerDay;
62 static const sal_Int64 minutePerDay = minutePerHour * hourPerDay;
63 static const sal_Int64 nanoPerMicro = 1000;
64 static const sal_Int64 nanoPerMilli = 1000000;
65 static const sal_Int64 nanoPerCenti = 10000000;
69 explicit Time( TimeInitSystem );
72 Time(
const css::util::Time& rTime );
73 explicit Time(
const css::util::DateTime& rDateTime );
74 Time( sal_uInt32 nHour, sal_uInt32 nMin,
75 sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 );
77 void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; }
78 sal_Int64
GetTime()
const {
return nTime; }
79 css::util::Time
GetUNOTime()
const {
return css::util::Time(GetNanoSec(),GetSec(),GetMin(),GetHour(),
false); }
81 void SetHour( sal_uInt16 nNewHour );
82 void SetMin( sal_uInt16 nNewMin );
83 void SetSec( sal_uInt16 nNewSec );
84 void SetNanoSec( sal_uInt32 nNewNanoSec );
86 { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
87 return static_cast<sal_uInt16
>(nTempTime / SAL_CONST_UINT64(10000000000000)); }
89 { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
90 return static_cast<sal_uInt16
>((nTempTime / SAL_CONST_UINT64(100000000000)) % 100); }
92 { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
93 return static_cast<sal_uInt16
>((nTempTime / SAL_CONST_UINT64(1000000000)) % 100); }
95 { sal_uInt64 nTempTime = (nTime >= 0) ? nTime : -nTime;
96 return static_cast<sal_uInt32
>( nTempTime % SAL_CONST_UINT64(1000000000)); }
99 sal_Int32 GetMSFromTime()
const;
100 void MakeTimeFromMS( sal_Int32 nMS );
101 sal_Int64 GetNSFromTime()
const;
102 void MakeTimeFromNS( sal_Int64 nNS );
105 double GetTimeInDays()
const;
122 static void GetClock(
double fTimeInDays,
123 sal_uInt16& nHour, sal_uInt16& nMinute, sal_uInt16& nSecond,
124 double& fFractionOfSecond,
int nFractionDecimals );
126 bool IsEqualIgnoreNanoSec(
const tools::Time& rTime )
const;
129 {
return (nTime == rTime.
nTime); }
131 {
return (nTime != rTime.
nTime); }
133 {
return (nTime > rTime.
nTime); }
135 {
return (nTime < rTime.
nTime); }
137 {
return (nTime >= rTime.
nTime); }
139 {
return (nTime <= rTime.
nTime); }
141 static Time GetUTCOffset();
148 static sal_uInt64 GetSystemTicks();
162 static sal_uInt64 GetMonotonicTicks();
166 {
return Time( -nTime ); }
bool operator==(const BigInt &rVal1, const BigInt &rVal2)
bool operator<(const BigInt &rVal1, const BigInt &rVal2)
FILE * init(int, char **)
bool operator>(const Fraction &rVal1, const Fraction &rVal2)
bool operator>=(const Fraction &rVal1, const Fraction &rVal2)
bool operator!=(const Fraction &rVal1, const Fraction &rVal2)
bool operator<=(const Fraction &rVal1, const Fraction &rVal2)
constexpr OUStringLiteral EMPTY
tools::Rectangle & operator+=(tools::Rectangle &rRect, const SvBorder &rBorder)