From 09fde55c7f32ca6bb9b56b5db6a0154054a7d95a Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Wed, 25 Mar 2009 21:03:21 +0000 Subject: [PATCH] * revert r29708, need to change some more stuff git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29709 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/shared/DateTime.h | 5 ++--- src/kits/shared/DateTime.cpp | 31 ++++++++++--------------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/headers/private/shared/DateTime.h b/headers/private/shared/DateTime.h index 53e354e4ed..d5f4c75bed 100755 --- a/headers/private/shared/DateTime.h +++ b/headers/private/shared/DateTime.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _DATE_TIME_H_ @@ -147,7 +147,6 @@ class BDate { class BDateTime { public: - BDateTime(); BDateTime(const BDate &date, const BTime &time); ~BDateTime(); @@ -162,7 +161,7 @@ class BDateTime { BTime Time() const; void SetTime(const BTime &time); - static uint32 Time_t(time_type type); + uint32 Time_t() const; private: BDate fDate; diff --git a/src/kits/shared/DateTime.cpp b/src/kits/shared/DateTime.cpp index b859682392..2fdd0a5719 100644 --- a/src/kits/shared/DateTime.cpp +++ b/src/kits/shared/DateTime.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -536,11 +536,10 @@ bool BDate::IsLeapYear(int32 year) const { if (year < 1582) { - if (year < 0) - year++; + if (year < 0) year++; return (year % 4) == 0; } - return (year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)); + return year % 400 == 0 || year % 4 == 0 && year % 100 != 0; } @@ -778,13 +777,6 @@ BDate::_DateToJulianDay(int32 _year, int32 month, int32 day) const // #pragma mark - BDateTime -BDateTime::BDateTime() - : fDate(BDate()), - fTime(BTime()) -{ -} - - BDateTime::BDateTime(const BDate &date, const BTime &time) : fDate(date), fTime(time) @@ -851,20 +843,17 @@ BDateTime::SetTime(const BTime &time) uint32 -BDateTime::Time_t(time_type type) +BDateTime::Time_t() const { - BTime time = BTime::CurrentTime(type); - BDate date = BDate::CurrentDate(type); - tm tm_struct; - tm_struct.tm_hour = time.Hour(); - tm_struct.tm_min = time.Minute(); - tm_struct.tm_sec = time.Second(); + tm_struct.tm_hour = fTime.Hour(); + tm_struct.tm_min = fTime.Minute(); + tm_struct.tm_sec = fTime.Second(); - tm_struct.tm_year = date.Year() - 1900; - tm_struct.tm_mon = date.Month() - 1; - tm_struct.tm_mday = date.Day(); + tm_struct.tm_year = fDate.Year() - 1900; + tm_struct.tm_mon = fDate.Month() - 1; + tm_struct.tm_mday = fDate.Day(); // set less 0 as we wan't use it tm_struct.tm_isdst = -1;