diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-07-28 16:08:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-04 11:02:56 +0200 |
commit | 43ea97e1f9cecd6c7cba8db35ce1307c858c6857 (patch) | |
tree | 5d4f81ad7e3a9e9e3af563ffe2df1661cb643bee /include/tools/date.hxx | |
parent | 9d07f380bb0d5053571a9f3866b0415fe8339c5b (diff) |
fdo#67235 adapt form control code to time nanosecond API change
squash of steps 1, 2 and 3 in master
Change-Id: If68ecf0691919d71d06d7b97d46db115013f9805
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/tools/date.hxx')
-rw-r--r-- | include/tools/date.hxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/include/tools/date.hxx b/include/tools/date.hxx index 714a97b85727..31cf706f3a5c 100644 --- a/include/tools/date.hxx +++ b/include/tools/date.hxx @@ -21,6 +21,8 @@ #include "tools/toolsdllapi.h" #include <tools/solar.h> +#include <com/sun/star/util/Date.hpp> +#include <sal/log.hxx> class ResId; @@ -31,6 +33,10 @@ class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Date { private: sal_uInt32 nDate; + void init( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ) + { nDate = ( sal_uInt32( nDay % 100 ) ) + + ( ( sal_uInt32( nMonth % 100 ) ) * 100 ) + + ( ( sal_uInt32( nYear % 10000 ) ) * 10000); } public: enum DateInitSystem @@ -52,12 +58,16 @@ public: Date( const Date& rDate ) { nDate = rDate.nDate; } Date( sal_uInt16 nDay, sal_uInt16 nMonth, sal_uInt16 nYear ) - { nDate = ( sal_uInt32( nDay % 100 ) ) + - ( ( sal_uInt32( nMonth % 100 ) ) * 100 ) + - ( ( sal_uInt32( nYear % 10000 ) ) * 10000); } + { init(nDay, nMonth, nYear); } + Date( const ::com::sun::star::util::Date& _rDate ) + { + SAL_WARN_IF(_rDate.Year < 0, "tools.datetime", "Negative year in css::util::Date to ::Date conversion"); + init(_rDate.Day, _rDate.Month, _rDate.Year); + } void SetDate( sal_uInt32 nNewDate ) { nDate = nNewDate; } sal_uInt32 GetDate() const { return nDate; } + ::com::sun::star::util::Date GetUNODate() const { return ::com::sun::star::util::Date(GetDay(), GetMonth(), GetYear()); } void SetDay( sal_uInt16 nNewDay ); void SetMonth( sal_uInt16 nNewMonth ); |