summaryrefslogtreecommitdiff
path: root/include/tools
diff options
context:
space:
mode:
Diffstat (limited to 'include/tools')
-rw-r--r--include/tools/datetime.hxx2
-rw-r--r--include/tools/duration.hxx2
-rw-r--r--include/tools/time.hxx5
3 files changed, 6 insertions, 3 deletions
diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx
index f50db1049a77..29dbc80d2ed1 100644
--- a/include/tools/datetime.hxx
+++ b/include/tools/datetime.hxx
@@ -48,7 +48,7 @@ public:
explicit DateTime( DateTimeInitSystem );
DateTime( const DateTime& rDateTime ) :
Date( rDateTime ), Time( rDateTime ) {}
- explicit DateTime( const Date& rDate ) : Date( rDate ), Time(0) {}
+ explicit DateTime( const Date& rDate ) : Date( rDate ), Time(Time::EMPTY) {}
explicit DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {}
DateTime( const Date& rDate, const tools::Time& rTime ) :
Date( rDate ), Time( rTime ) {}
diff --git a/include/tools/duration.hxx b/include/tools/duration.hxx
index 9f032539e142..ca0d7088b7e1 100644
--- a/include/tools/duration.hxx
+++ b/include/tools/duration.hxx
@@ -96,7 +96,7 @@ private:
void SetTimeDiff(const Time& rStart, const Time& rEnd);
private:
- Time maTime = Time(0);
+ Time maTime = Time(Time::EMPTY);
sal_Int32 mnDays = 0;
};
}
diff --git a/include/tools/time.hxx b/include/tools/time.hxx
index c92bdd9aee05..9b3d15f5ec22 100644
--- a/include/tools/time.hxx
+++ b/include/tools/time.hxx
@@ -40,6 +40,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Time
{
private:
sal_Int64 nTime;
+ explicit Time(sal_Int64 _nTime) { nTime = _nTime; }
static sal_Int64 assemble(sal_uInt32 h, sal_uInt32 m, sal_uInt32 s, sal_uInt64 ns);
short GetSign() const { return (nTime >= 0) ? +1 : -1; }
@@ -78,13 +79,15 @@ public:
explicit Time( TimeInitEmpty )
{ nTime = 0; }
explicit Time( TimeInitSystem );
- explicit Time( sal_Int64 _nTime ) { Time::nTime = _nTime; }
Time( const tools::Time& rTime ) = default;
explicit Time( const css::util::Time& rTime );
explicit Time( const css::util::DateTime& rDateTime );
Time( sal_uInt32 nHour, sal_uInt32 nMin,
sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 );
+ // The argument is not nanoseconds, it's what nTime must contain!
+ static Time fromEncodedTime(sal_Int64 _nTime) { return Time(_nTime); }
+
void SetTime( sal_Int64 nNewTime ) { nTime = nNewTime; }
sal_Int64 GetTime() const { return nTime; }
css::util::Time GetUNOTime() const { return css::util::Time(GetNanoSec(),GetSec(),GetMin(),GetHour(),false); }