* revert r29708, need to change some more stuff

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29709 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich 2009-03-25 21:03:21 +00:00
parent 6d585c1cb0
commit 09fde55c7f
2 changed files with 12 additions and 24 deletions

View File

@ -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. * Distributed under the terms of the MIT License.
*/ */
#ifndef _DATE_TIME_H_ #ifndef _DATE_TIME_H_
@ -147,7 +147,6 @@ class BDate {
class BDateTime { class BDateTime {
public: public:
BDateTime();
BDateTime(const BDate &date, const BTime &time); BDateTime(const BDate &date, const BTime &time);
~BDateTime(); ~BDateTime();
@ -162,7 +161,7 @@ class BDateTime {
BTime Time() const; BTime Time() const;
void SetTime(const BTime &time); void SetTime(const BTime &time);
static uint32 Time_t(time_type type); uint32 Time_t() const;
private: private:
BDate fDate; BDate fDate;

View File

@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@ -536,11 +536,10 @@ bool
BDate::IsLeapYear(int32 year) const BDate::IsLeapYear(int32 year) const
{ {
if (year < 1582) { if (year < 1582) {
if (year < 0) if (year < 0) year++;
year++;
return (year % 4) == 0; 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 // #pragma mark - BDateTime
BDateTime::BDateTime()
: fDate(BDate()),
fTime(BTime())
{
}
BDateTime::BDateTime(const BDate &date, const BTime &time) BDateTime::BDateTime(const BDate &date, const BTime &time)
: fDate(date), : fDate(date),
fTime(time) fTime(time)
@ -851,20 +843,17 @@ BDateTime::SetTime(const BTime &time)
uint32 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 tm_struct;
tm_struct.tm_hour = time.Hour(); tm_struct.tm_hour = fTime.Hour();
tm_struct.tm_min = time.Minute(); tm_struct.tm_min = fTime.Minute();
tm_struct.tm_sec = time.Second(); tm_struct.tm_sec = fTime.Second();
tm_struct.tm_year = date.Year() - 1900; tm_struct.tm_year = fDate.Year() - 1900;
tm_struct.tm_mon = date.Month() - 1; tm_struct.tm_mon = fDate.Month() - 1;
tm_struct.tm_mday = date.Day(); tm_struct.tm_mday = fDate.Day();
// set less 0 as we wan't use it // set less 0 as we wan't use it
tm_struct.tm_isdst = -1; tm_struct.tm_isdst = -1;