History log of /haiku/src/kits/support/DateTime.cpp
Revision Date Author Comments
# ffd9d565 01-Nov-2018 Adrien Destugues <pulkomandy@pulkomandy.tk>

BDate: do not use strftime

Using BDateFimeFormat avoids going through libroot and up again to ICU
throuhg the locale add-on. Moreover, it uses the Locale settings
directly instead of relying on the LC_* environment variables.

Fixes day names in Web+ history menu always showing in english. Tnaks to
Oco for noticing!

Change-Id: I0c7f321a6147e8f5ab31f82de836c5ad23bb321b
Reviewed-on: https://review.haiku-os.org/650
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 7407e36a 31-Jan-2017 Andrew Lindesay <apl@lindesay.co.nz>

HaikuDepot; date formatting and location header handling

The existing HTTP header date format handling code is employed
rather than using specific logic for HD. Also the "Location"
header handling is changed to work better for non-absolute
URLs arriving in this header value on a redirect. Both
suggestions from Adrien.


# 19d8cb70 31-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

BDate: added time_t constructor.

* This class is pretty much useless as it is.


# afd5ec11 30-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

Add setters to BDate and BCalendarView

* BDate setters don't perform any validation, use with caution.
* BCalendarView setters do perform validation checks, and will adjust
the day so it fits the requested month or year.
* Add tests for the BCalendarView setters.


# f188c1de 30-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

BDateFormat: improve API

* Use a reference rather than a pointer for the output string, removing
the need for NULL checks (which were missing, anyway)
* Adjust callers to that change
* Add new Format variant taking a BDate argument


# 29e8fa59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# dbd4f8c4 16-Jun-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

SetTime_t: Use the sign-fixed modulo we computed

* In C++03 and earlier, the sign of the modulo result is implementation
defined (this was fixed in C++11).
* Setting a negative time is not what we want here, so make sure we use
the proper value.


# d05f9e2d 10-Oct-2013 Adrien Destugues <pulkomandy@pulkomandy.tk>

BDateTime: Time_T functions return or take a time_t

* They used an unsigned int, which led to overflows when trying to set
them to a time before January 1st, 1970 (local time)
* Some things use January 1st, 1970, GMT (or UTC) as a reference point.
In my timezone this leads to such a negative date. An example is cookie
expiration dates which are set to this date to expire them immediately.
Spotted by Opera testsuite.
* This makes the method unuseable for dates after 2036 (signed 32-bit
time_t will overflow then. This gives us just 33 years to switch to a
64-bit time_t. In te meantime, please try using other methods to set the
date and time for BDateTime objects if you need to go this far.


# aac8a4c3 07-Sep-2011 Oliver Tappe <zooey@hirschkaefer.de>

Fix clamping in BDate::AddMonths():
* use _DaysInMonth() instead of DaysInMonth(), as the latter only works
for valid dates, which we do not have if the day needs to be clamped
to the maximum value for the current month


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42719 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23281fb2 05-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Moved Easter holidays methods to a Holiday class, an hopefully better place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40125 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96827f26 04-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Ooops. Fix AscensionDay and PentecostDay.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40117 a95241bf-73f2-0310-859d-f6bbb57e9c96


# daf3c505 04-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* changed some methods to static as that's what they are in the end.
* added some methods to find out easter sunday, ascension and pentecost days.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 559cf371 16-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* fix oversight that gmtime() and localtime() may return NULL, which would lead
to a crash


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbba047c 17-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Added copy constructors.
* Let the AddHours(), Add*() return itself, so that they can be chained.
* Made the previous *Name() methods static and added non-static versions that
take the day/month of the object.
* Make BDateTime::Date/Time() return references (const or non-const).
* Fixed the BDateTime comparison operators.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a070cf53 06-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Indentation update in DateTime.h
* Extended BTime, BDate and BDateTime with archiving functionality.
* Adjusted code which uses these classes, since including DateTime.h
already imports the classes from the BPrivate namespace.
* Moved DateTime.h into Support Kit. It is still in the BPrivate namespace,
as I am uncertain what to do with time_type and diff_type. I'd favor
moving the constants into the classes itself. Possibly removing the B_
prefix from them. Feedback welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35772 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 19d8cb703c30602e188891a9a82bfabe55f690e7 31-Aug-2015 Axel Dörfler <axeld@pinc-software.de>

BDate: added time_t constructor.

* This class is pretty much useless as it is.


# afd5ec11d21761cb3f1edcd80e5206347fe975c5 30-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

Add setters to BDate and BCalendarView

* BDate setters don't perform any validation, use with caution.
* BCalendarView setters do perform validation checks, and will adjust
the day so it fits the requested month or year.
* Add tests for the BCalendarView setters.


# f188c1defa3ffef28c2a76b1b21fa7dc017f3e5b 30-Sep-2014 Adrien Destugues <pulkomandy@gmail.com>

BDateFormat: improve API

* Use a reference rather than a pointer for the output string, removing
the need for NULL checks (which were missing, anyway)
* Adjust callers to that change
* Add new Format variant taking a BDate argument


# 29e8fa5922c9f9a5eb09a2fcc92e7fb321d4cc59 24-Jun-2014 John Scipione <jscipione@gmail.com>

Style fixes to Support Kit files


# dbd4f8c46b968842d5fae1a1e86868934c90ad62 16-Jun-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

SetTime_t: Use the sign-fixed modulo we computed

* In C++03 and earlier, the sign of the modulo result is implementation
defined (this was fixed in C++11).
* Setting a negative time is not what we want here, so make sure we use
the proper value.


# d05f9e2d3d13931ef7a10bdc065b385dc341746d 10-Oct-2013 Adrien Destugues <pulkomandy@pulkomandy.tk>

BDateTime: Time_T functions return or take a time_t

* They used an unsigned int, which led to overflows when trying to set
them to a time before January 1st, 1970 (local time)
* Some things use January 1st, 1970, GMT (or UTC) as a reference point.
In my timezone this leads to such a negative date. An example is cookie
expiration dates which are set to this date to expire them immediately.
Spotted by Opera testsuite.
* This makes the method unuseable for dates after 2036 (signed 32-bit
time_t will overflow then. This gives us just 33 years to switch to a
64-bit time_t. In te meantime, please try using other methods to set the
date and time for BDateTime objects if you need to go this far.


# aac8a4c3c46997bc19b61da38c24e92000d15119 07-Sep-2011 Oliver Tappe <zooey@hirschkaefer.de>

Fix clamping in BDate::AddMonths():
* use _DaysInMonth() instead of DaysInMonth(), as the latter only works
for valid dates, which we do not have if the day needs to be clamped
to the maximum value for the current month


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42719 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23281fb2c1860de19cb5ec1ce7322209e7718a76 05-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Moved Easter holidays methods to a Holiday class, an hopefully better place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40125 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96827f26201242b9ebc550fc725f352915e37796 04-Jan-2011 Jérôme Duval <korli@users.berlios.de>

Ooops. Fix AscensionDay and PentecostDay.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40117 a95241bf-73f2-0310-859d-f6bbb57e9c96


# daf3c505296ff7043b13af0d64fdeb5edfd39cdf 04-Jan-2011 Jérôme Duval <korli@users.berlios.de>

* changed some methods to static as that's what they are in the end.
* added some methods to find out easter sunday, ascension and pentecost days.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 559cf371bc5bfd9c3552e93af3c87403fb6a215f 16-Aug-2010 Oliver Tappe <zooey@hirschkaefer.de>

* fix oversight that gmtime() and localtime() may return NULL, which would lead
to a crash


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbba047c2d5a70de9ef1072a95d555923d6287b5 17-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Added copy constructors.
* Let the AddHours(), Add*() return itself, so that they can be chained.
* Made the previous *Name() methods static and added non-static versions that
take the day/month of the object.
* Make BDateTime::Date/Time() return references (const or non-const).
* Fixed the BDateTime comparison operators.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a070cf5306662fec199ccf79c0e9872fbcd0fc75 06-Mar-2010 Stephan Aßmus <superstippi@gmx.de>

* Indentation update in DateTime.h
* Extended BTime, BDate and BDateTime with archiving functionality.
* Adjusted code which uses these classes, since including DateTime.h
already imports the classes from the BPrivate namespace.
* Moved DateTime.h into Support Kit. It is still in the BPrivate namespace,
as I am uncertain what to do with time_type and diff_type. I'd favor
moving the constants into the classes itself. Possibly removing the B_
prefix from them. Feedback welcome.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35772 a95241bf-73f2-0310-859d-f6bbb57e9c96