777 Commits

Author SHA1 Message Date
Howard Hinnant
2d115a8022 Add to_duration() to time_of_day:
* This is a synonym for static_cast<precision>(*this).
* This variation can be easier to spell when the precision
  is not conveniently available.
2015-08-08 13:38:12 -04:00
Howard Hinnant
33f923b508 Rename seconds_point to second_point for consistency with day_point. 2015-08-08 13:20:12 -04:00
Howard Hinnant
0d0841f5b8 Rename current_timezone() to current_zone():
* Better symmetry with locate_zone(name).
2015-08-08 13:06:04 -04:00
Howard Hinnant
0fe43bab32 Merge branch 'test'.
The unit tests are still very much a work in progress.
But the work now lives on the master branch.
2015-08-08 12:52:45 -04:00
Howard Hinnant
5104a4afcb Revert: Make months and years not convertible to seconds:
* After much consideration I consider this not a good change.
* It introduced a completely arbitrary mathematical relationship
  among the units.
* This commit restores a precise relationship among the units which
  is based on the Gregorian calendar.
* However this experiment has been preserved in the git history.
2015-08-08 12:45:55 -04:00
gm
c21e392c81 Initial Win32 support.
This library now compiles on Windows but requires VS2015 for Windows.
VS2013 may work but this has not been tested yet.
Requires NOMINMAX to be defined to avoid clashes with the Windows.h
headers and the C++ stl and this libraries Date max functions.
Also known to work equivalently with recent g++ and mingw combinations
but -std=C++14 flag should be set.
C++14 restrictions may be relaxed later. Patches welcome!
g++ 5.1 was tested. It may work with other version but that hasn't been tried.
Mac OS and Linux systems are known to compile with -std=c++11
current_timezone and locate_zone will return iana names not windows
time zone names. This is expected and as designed.
2015-08-06 23:16:03 -04:00
HowardHinnant
225a2b6c65 Update README.md 2015-08-05 21:31:12 -04:00
HowardHinnant
328d2a0fd0 Update README.md 2015-08-05 21:27:20 -04:00
Howard Hinnant
fd485c5383 [X] Make months and years not convertible to seconds:
* The Gregorian average of months and years is an
  integral number of seconds.
* This patch slightly tweaks the average to make it
  not an integral number of seconds, and thus these
  units no longer implicitly convert to seconds.
* This will flag naive  mixing of years, months and seconds
  as a compile time error.
2015-08-05 21:11:50 -04:00
Howard Hinnant
16775dccb9 Remove streaming for time_points with resolution greater...
than a day.

* cout << floor<years>(system_clock::now()) is very confusing.
* The aforementioned streaming operation is now a compile time error.
2015-08-03 22:13:20 -04:00
Howard Hinnant
756460892c Initial unit test submission. 2015-08-02 15:56:48 -04:00
Howard Hinnant
94237ceaa7 Take into account that year::ok() may now return false. 2015-08-02 12:30:49 -04:00
Howard Hinnant
c99a40b846 Add year_month += and -= operators. 2015-08-01 19:16:33 -04:00
Howard Hinnant
2e715844bb Restrict the range of year:
to within the range of chrono::minutes.
* This prevents overflow when adding minutes to day_point
  when minutes is stored in 32 bits.
* Also added static checks on the range of hours and seconds.
  If these static checks fire, the range of year should be
  further reduced.
* This does not impact gcc at all.  It impacts clang only
  when targeting 32 bit architectures.  And it fixes
  overflow on Visual Studio.
* Thanks much to https://github.com/gmcode for the herculean
  effort in tracking this down.
2015-08-01 16:49:51 -04:00
Ville Voutilainen
17bd48d23c An attempt to tidy up current_timezone() 2015-07-30 01:01:19 +03:00
Howard Hinnant
a2c632bb5b Silence a few warnings on VS. 2015-07-28 21:56:14 -04:00
Howard Hinnant
07361f9d86 Reduce technology down to what VS can handle. 2015-07-28 11:00:53 -04:00
gm
51864f56c1 Try to make current time zone work with Linux. e.g. Ubuntu and Fedora 2015-07-27 18:45:43 -04:00
Howard Hinnant
5c370dbfd9 Port to gcc-5.2.0 on OS X.
*  This also fixes an overflow bug in Zone::get_info.
2015-07-25 18:01:31 -04:00
Howard Hinnant
0c44d8c70d Specialize streaming operator for day_point. 2015-07-20 14:58:05 -04:00
Howard Hinnant
12a769653e Fix rule finding logic for falling off the front of the rule list 2015-07-18 23:11:20 -04:00
Howard Hinnant
9858887551 Correct some silly spelling errors. 2015-07-18 18:58:48 -04:00
Howard Hinnant
73f70c77aa Merge branch 'master' of github.com:HowardHinnant/date 2015-07-18 17:40:36 -04:00
Howard Hinnant
a431164fcd Add missing 'backward' file and correct output of negative values for time_of_day_storage. 2015-07-18 17:40:18 -04:00
HowardHinnant
55282ee1c7 Update README.md 2015-07-18 14:47:12 -04:00
HowardHinnant
4a1697a585 Create README.md 2015-07-17 23:35:23 -04:00
Howard Hinnant
796448e4ad Initial commit 2015-07-17 22:30:53 -04:00