Compare commits

...

454 Commits

Author SHA1 Message Date
James E. King III 417c0c4d12 Update timezone data file to IANA 2025b
Ingested tooling from https://github.com/fmidev/smartmet-timezones
and updated timezone data README so we have a means to regenerate
the file that is documented.

Compared to IANA 2016c, the timezone information in 2025c no longer
has a distinction between short and long names.  For example in
2016c America/Denver used MST for short, Mountain Standard Time
for long, but America/Boise used MST for both.  With 2025c they
both use MST for short and long, which also means that the built-in
"Coordinated Universal Time" long form is now displayed as "UTC"
like the short form.

While this does not fully resolve #67, it does help us maintain
the time zone data file better.
2025-07-07 07:14:26 -04:00
James E. King III 69c45b7a2b Update README 2025-07-07 06:39:45 -04:00
James E. King III 19ffa6232d Implement a reusable GHA workflow with configuration options. 2025-07-06 22:04:23 -04:00
Jeff Garland 363e04d7ec Merge pull request #242 from jeking3/coverity-255065
issue-204: period::intersects incorrect for empty periods
2025-07-06 18:06:39 -07:00
James E. King III 64c1df1e3e issue-204: period::intersects incorrect for empty periods
Originally identified by Coverity Scan.  Zero length periods like
[3, 3) cannot intersect with anything.  Invalid periods like
[5, 4) also cannot intersect with anything.  In both cases the
unit tests are wrong, and fixing them reveals the implementation
is not canonical for half-open sane intervals.
2025-07-06 14:56:23 -04:00
René Ferdinand Rivera Morell 645574e5df Add support for modular build structure. (#239)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add missing NO_LIB usage requirements.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Adjust doc build to avoid boost-root references.

* Update build deps.

* Rework GHA to use containers for the ubuntu that are god or going away.

* Remove obsolete package installs.

* Need another package?

* Some deepndencies are now C++11 only. Hence date_time is now also C++11 only.

* Switch macOS test to use the latest version.

* Remove not-needed software-properties-common package.

* Remove setup gcc toolchain step.

* Install some missing compilers.

* Maybe the gcc builds for the specific ubuntu versions rea broken. Switch to something newer.
2025-06-27 02:30:25 +03:00
Baoshuo Ren 39714907b7 chore: bump macos runner version (#213)
GitHub Action is sunsetting the macOS 10.15 Actions runner. It will stop working intermittently until being completely removed by 2022-8-30: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22
2022-09-20 15:13:04 -07:00
Alexander Grund abef5a147a Fix ccache saving on cache hit (#211)
See boostorg/boost-ci#166
2022-09-20 15:12:17 -07:00
Luke Mewburn ddcfd00391 Iso doc fixes (#215)
* to_iso_*string() use "." as fractional separator

The fractional separator for the various to_iso_* methods
is "." not "," (per to_iso_string_type() implementation).
Fix the documentation to match the implementation.

* use "ISO 8601" not "iso" in documentation

The standard is "ISO 8601", so use that instead
of just "iso" or "ISO" in comments and documentation.

* fractional seconds only included if non-zero (#110)

Consistently document that the fractional seconds
are only included if non-zero.

Use "where fffffffff" not "were fff".
2022-09-20 15:10:38 -07:00
Antony Polukhin c02d713cef Avoid using likely function as multiple projects define a likely macro (#216) 2022-09-08 04:01:15 -07:00
Povilas Kanapickas b81ed2874f Fix constexpr of gregorian::date::date(special_values) to improve perf (#214)
GCC up to at least 10.2 fail to resolve
gregorian::date::date(special_values) as constexpr function due to
assignment to *this within the constructor. Refactoring constructor to
initialize the instance once leads to large performance improvement.
2022-08-01 03:34:36 -07:00
Quinnsicle 0aed920bfb fix typo in time_period docs (#212)
Co-authored-by: Quinn O'Connor <qoconnor@fastenal.com>
2022-07-02 10:41:51 -07:00
Raphaël Duhen f972dc9656 Fix minor typo (#210)
Thanks!
2022-04-29 09:33:12 -07:00
James E. King III 7677fdce5a Fix appveyor links in readme 2022-04-28 08:08:09 -04:00
James E. King III 8729945096 remove drone config 2022-04-24 21:00:53 -04:00
Owen Rudge cbad9bcec9 Add from_time_t test for 64-bit time_t 2022-03-01 11:15:22 -05:00
Owen Rudge 64fe6586fe Fix from_time_t Y2K38 bug on LLP64 platforms 2022-03-01 11:15:22 -05:00
James E. King III a20a5c8b7c Merge branch 'master' into develop 2022-02-20 06:58:55 -05:00
timmaraju ff77162265 fix signed to unsigned conversion warning (#179)
MSVC 19.28.29336.0 throws the following warning when
boost::date_time::gregorian_date is called.

warning C4365: 'initializing': conversion from 'int' to 'unsigned long', signed/unsigned mismatch
warning C4365: const boost::posix_time::ptime Since1970(boost::gregorian::date(1970U, 1U, 1U));
warning C4365:                                                                                ^
<path>\include\boost\date_time\date.hpp(72,35): message : while evaluating constexpr function 'boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::day_number'
<path>\include\boost\date_time\date.hpp(72,35): message :       : days_(calendar::day_number(ymd_type(y, m, d)))

Co-authored-by: timmaraju <keerthi.timmaraju@teamviewer.com>
2022-02-12 05:53:38 -07:00
James E. King III 0be5d92c90 refresh ci, codecov, readme
- align to current boost-ci practice
- deal with VERY slow test runner in microsec_time_clock test
- disable sanitize tests - too many issues in boost serialization right now
- omit unit tests from coverage
2022-02-11 21:14:28 -05:00
Jeff Garland 33dc6136f1 misc fixes and updates for date-time boost 1.77 (#196)
* Change greg_month and greg_weekday to be not marked as exported/imported (#146)

* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

* fix new msvc warning in date_parsing with Warn4 - issue #148

* Cast month numbers to the correct type in map init (#152)

Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.

* Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)

* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.

* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.

* Include the header file.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."

This reverts commit 88e45e951b.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Remove separate outside of template class friend functions.

* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* tune: add initial cmake configuration (#151)

* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)

Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>

* Break DateTime <-> Serialization circular dependency (#154)

Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)

C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.

* Suppress MSVC CRT deprecations on Clang (#160)

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Add BOOST_CXX14_CONSTEXPR to CV assign() (#161)

Without this change the BOOST_CXX14_CONSTEXPR on the constructors has no
effect, as they invoke assign()

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* add constexpr tests to date, ptime, constrained_value (#162)

* merge some doc changes for constexpr fix (#163)

* add constexpr tests to date, ptime, constrained_value

* add some docs for 1.74 release

* const-qualify retrieval and comparison methods of time_itr and date_itr_base (#170)

* [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's  compilation level, without having to search the library's documentation to find this out. (#178)

* add drone config [ci skip] (#180)

* Add GitHub Actions config [ci skip] (#182)

* Update README.md

* Update README.md

* Update README.md

fixup comments on readme to match header_only status

* fix #189 for autolink -- driveby change to remove gcc2.95 support (#191)

* ptime from iso error string error with date only (#192)

* fix #189 for autolink -- driveby change to remove gcc2.95 support

* fix #187 date-only case to avoid string exception, beef up error case test

* ci updates (#194)

* fix #189 for autolink -- driveby change to remove gcc2.95 support

* fix #187 date-only case to avoid string exception, beef up error case test

* attempted fix for #193 - ci issues

* attempted fix for #193 - ci issues try 2

* attempted fix for #193 - ci issues try 3

* attempted fix for #193 - ci issues try 4

* attempted fix for #193 - ci issues try 4a

* attempted fix for #193 - ci issues try 5

* attempted fix for #193 - ci issues try 6

* attempted fix for #193 - ci issues try 7 - rm clang 3.8

* Regenerate CMakeLists.txt

* Add stub source file

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
Co-authored-by: tapika <tapika@yahoo.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
Co-authored-by: Roger Orr <rogero@howzatt.co.uk>
Co-authored-by: klaus triendl <klaus@triendl.eu>
Co-authored-by: Sam Darwin <samuel.d.darwin@gmail.com>
Co-authored-by: Peter Dimov <pdimov@gmail.com>
2021-06-28 08:14:45 -07:00
Jeff Garland 7156392706 Merge branch 'master' into develop 2021-06-28 07:55:17 -07:00
Peter Dimov 561ccb878d Add stub source file 2021-06-08 21:52:12 +03:00
Peter Dimov 3feaece6d2 Regenerate CMakeLists.txt 2021-06-08 21:51:59 +03:00
Peter Dimov 9970590094 Add stub source file 2021-05-28 01:27:21 +03:00
Peter Dimov 4b97311ca7 Regenerate CMakeLists.txt 2021-05-28 01:26:14 +03:00
Jeff Garland a94bcf288d ci updates (#194)
* fix #189 for autolink -- driveby change to remove gcc2.95 support

* fix #187 date-only case to avoid string exception, beef up error case test

* attempted fix for #193 - ci issues

* attempted fix for #193 - ci issues try 2

* attempted fix for #193 - ci issues try 3

* attempted fix for #193 - ci issues try 4

* attempted fix for #193 - ci issues try 4a

* attempted fix for #193 - ci issues try 5

* attempted fix for #193 - ci issues try 6

* attempted fix for #193 - ci issues try 7 - rm clang 3.8
2021-05-02 17:27:18 -07:00
Jeff Garland 8011fdf0bc ptime from iso error string error with date only (#192)
* fix #189 for autolink -- driveby change to remove gcc2.95 support

* fix #187 date-only case to avoid string exception, beef up error case test
2021-05-02 08:57:36 -07:00
Jeff Garland 15be01a02d fix #189 for autolink -- driveby change to remove gcc2.95 support (#191) 2021-04-30 11:51:48 -07:00
Jeff Garland acbee0dc6a Update README.md
fixup comments on readme to match header_only status
2021-03-23 08:28:14 -07:00
Jeff Garland aa9c5dfd48 Update README.md 2021-03-23 08:26:07 -07:00
Jeff Garland 47de78e4fc Update README.md 2021-03-23 08:25:32 -07:00
Jeff Garland 79ca1aa0a7 Merge minor date-time updates for boost 1.76 (#183)
* Change greg_month and greg_weekday to be not marked as exported/imported (#146)

* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

* fix new msvc warning in date_parsing with Warn4 - issue #148

* Cast month numbers to the correct type in map init (#152)

Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.

* Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)

* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.

* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.

* Include the header file.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."

This reverts commit 88e45e951b.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Remove separate outside of template class friend functions.

* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* tune: add initial cmake configuration (#151)

* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)

Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>

* Break DateTime <-> Serialization circular dependency (#154)

Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)

C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.

* Suppress MSVC CRT deprecations on Clang (#160)

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Add BOOST_CXX14_CONSTEXPR to CV assign() (#161)

Without this change the BOOST_CXX14_CONSTEXPR on the constructors has no
effect, as they invoke assign()

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* add constexpr tests to date, ptime, constrained_value (#162)

* merge some doc changes for constexpr fix (#163)

* add constexpr tests to date, ptime, constrained_value

* add some docs for 1.74 release

* const-qualify retrieval and comparison methods of time_itr and date_itr_base (#170)

* [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's  compilation level, without having to search the library's documentation to find this out. (#178)

* add drone config [ci skip] (#180)

* Add GitHub Actions config [ci skip] (#182)

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
Co-authored-by: tapika <tapika@yahoo.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
Co-authored-by: Roger Orr <rogero@howzatt.co.uk>
Co-authored-by: klaus triendl <klaus@triendl.eu>
Co-authored-by: Sam Darwin <samuel.d.darwin@gmail.com>
2021-03-05 08:49:04 -07:00
Sam Darwin ccc21804bd Add GitHub Actions config [ci skip] (#182) 2021-03-04 12:59:38 -07:00
Sam Darwin 31c983b256 add drone config [ci skip] (#180) 2021-01-26 16:17:52 -07:00
Edward Diener f92b2b3bfc [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. (#178) 2021-01-19 17:59:35 -07:00
klaus triendl b43d605ad2 const-qualify retrieval and comparison methods of time_itr and date_itr_base (#170) 2020-09-03 16:19:53 -07:00
Jeff Garland fa46e55ca8 final merges for 1.74 (#164)
* Change greg_month and greg_weekday to be not marked as exported/imported (#146)

* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

* fix new msvc warning in date_parsing with Warn4 - issue #148

* Cast month numbers to the correct type in map init (#152)

Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.

* Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)

* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.

* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.

* Include the header file.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."

This reverts commit 88e45e951b.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Remove separate outside of template class friend functions.

* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* tune: add initial cmake configuration (#151)

* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)

Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>

* Break DateTime <-> Serialization circular dependency (#154)

Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)

C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.

* Suppress MSVC CRT deprecations on Clang (#160)

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Add BOOST_CXX14_CONSTEXPR to CV assign() (#161)

Without this change the BOOST_CXX14_CONSTEXPR on the constructors has no
effect, as they invoke assign()

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* add constexpr tests to date, ptime, constrained_value (#162)

* merge some doc changes for constexpr fix (#163)

* add constexpr tests to date, ptime, constrained_value

* add some docs for 1.74 release

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
Co-authored-by: tapika <tapika@yahoo.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
Co-authored-by: Roger Orr <rogero@howzatt.co.uk>
2020-07-16 09:01:11 -07:00
Jeff Garland 61677ba228 merge some doc changes for constexpr fix (#163)
* add constexpr tests to date, ptime, constrained_value

* add some docs for 1.74 release
2020-07-13 08:12:09 -07:00
Jeff Garland 30795441e4 add constexpr tests to date, ptime, constrained_value (#162) 2020-07-09 08:06:58 -07:00
Roger Orr 77495803c1 Add BOOST_CXX14_CONSTEXPR to CV assign() (#161)
Without this change the BOOST_CXX14_CONSTEXPR on the constructors has no
effect, as they invoke assign()

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
2020-07-08 08:41:24 -07:00
Nikita Kniazev 247424d08d Suppress MSVC CRT deprecations on Clang (#160)
Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
2020-07-08 07:56:10 -07:00
Jeff Garland ab066e3601 merge date_time maintenance changes for boost 1.74 (#159)
* Change greg_month and greg_weekday to be not marked as exported/imported (#146)

* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

* fix new msvc warning in date_parsing with Warn4 - issue #148

* Cast month numbers to the correct type in map init (#152)

Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.

* Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)

* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.

* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.

* Include the header file.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."

This reverts commit 88e45e951b.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Remove separate outside of template class friend functions.

* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* tune: add initial cmake configuration (#151)

* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)

Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>

* Break DateTime <-> Serialization circular dependency (#154)

Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>

* Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)

C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
Co-authored-by: tapika <tapika@yahoo.com>
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
Co-authored-by: Nikita Kniazev <nok.raven@gmail.com>
2020-06-25 16:45:21 -07:00
Andrey Semashev 76852e4aab Fix clang 10 C++17 warnings about deprecated implicit assignment operators. (#158)
C++17 deprecates implicit generation of assignment operator in presence of
explicitly declared copy constructor. In future standards this behavior may
be removed.

In the affected Boost.DateTime classes, the explicitly defined copy
constructors are functionally equivalent to those would be generated
implicitly, so we can just remove them. The additional benefit is that the
implicitly generated ones will have constexpr and noexcept specifications,
and will also allow implicit move constructors and assignment operators.
2020-06-23 13:28:16 -07:00
Nikita Kniazev 356c5c2600 Break DateTime <-> Serialization circular dependency (#154)
Breaks DateTime -> Serialization -> Spirit -> Thread -> DateTime chain.

The Serialization documentation seems to be explicitly allow this:
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/traits.html#version
https://www.boost.org/doc/libs/1_73_0/libs/serialization/doc/serialization.html#splitting

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
2020-05-25 09:39:21 -07:00
EugeneZelenko 3d55c15cbb Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. (#155)
Also fix Clang -Wextra-semi-stmt and Clang-tidy readability-container-size-empty warnings.
Alphabetical order of STL headers.
Fix some misspellings.

Co-authored-by: Eugene Zelenko <eugene@diakopto.com>
2020-05-23 07:19:59 -07:00
tapika d77ee59bc2 tune: add initial cmake configuration (#151)
* tune: add initial cmake configuration

* bugfix: Incorrect library alias

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
2020-05-18 13:59:29 -07:00
Edward Diener 5093074e0e Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74 (#150)
* Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers.

* Change BOOST_BORLANDC back to __BORLANDC__ for non-posix functionality.

* Include the header file.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Revert "Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero."

This reverts commit 88e45e951b.

* Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.

* Remove separate outside of template class friend functions.

* Define all the friend functions outside the class to conform with the necessity of Embarcadero C++ clang-based compilers that need the friend functions in exported/imported classes to be defined outside the class. This is an Embarcadero C++ clang-based compiler bug which i reported to Embarcadero.

Co-authored-by: Jeff Garland <jeff@crystalclearsoftware.com>
2020-05-04 09:09:57 -07:00
Andrey Semashev ecf042f538 Cast month numbers to the correct type in map init (#152)
Since the map contains unsigned short for month numbers, it is more correct to explicitly cast constants to that type rather than short.
2020-05-03 07:52:25 -07:00
JeffGarland d0b3c1da88 fix new msvc warning in date_parsing with Warn4 - issue #148 2020-04-10 06:27:11 -07:00
Jeff Garland b03272650e Change greg_month and greg_weekday to be not marked as exported/imported (#146) (#147)
* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.

Co-authored-by: Andrey Semashev <Lastique@users.noreply.github.com>
2020-04-06 10:02:51 -07:00
Andrey Semashev e9a9ce3e35 Change greg_month and greg_weekday to be not marked as exported/imported (#146)
* Changed greg_month and greg_weekday to be not marked as exported/imported.

Both greg_month and greg_weekday classes are implemented completely in headers,
so they need not be marked with BOOST_DATE_TIME_DECL. For consistency with other
similar classes, they are now marked with BOOST_SYMBOL_VISIBLE.

This should fix linking errors on Windows/MSVC, where all members of greg_month
and greg_weekday classes remain unresolved as they are expected to be
implemented in a shared library.

* Enabled shared and static linking in AppVeyor CI.
2020-04-06 08:55:36 -07:00
JeffGarland 0c1d8fddd8 fix merge conflicts to master from develop for boost 1.73 2020-04-05 15:27:12 -07:00
Jeff Garland ad3239b722 date_time documentation updates for release 1.73 (#128)
* change gettimeofday to be clearer - issue #127

* clarify date_number docs - github issue #125

* add docs for from_iso_extended_string function - issue #116

* update documentation for 1.73 release - changes.xml
2020-04-05 14:14:40 -07:00
Andrey Semashev d335a54e9f Add missing includes and fix special_value_from_string definition (#144)
* Added a test generator for whether all public headers are self-contained.

The generator creates a compile test for every public header, unless
BOOST_DATE_TIME_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS environment variable
is set to 1.

* Only enable self-contained header tests on a few jobs.

There is no point in performing self-contained header tests on every compiler
configuration, so running them only on some saves CI time.

* Make public headers self-contained.

This commit:

- Adds missing includes.
- Adjusts gregorian namespace qualification in a few places to use use
  equivalent symbols from date_time and not have to include gregorian
  headers.
- Converts tabs to spaces and trims trailing spaces.

This makes the self-contained header tests pass on Linux.

* Move special_value_from_string definition to parsers.hpp.

This resolves different attributes applied to the function definition
in parsers.hpp and greg_month.hpp. The function is now inline and defined
in parsers.hpp.

Also, the commit converts tabs to spaces and trims trailing spaces.

Fixes https://github.com/boostorg/date_time/issues/143.

* Convert tabs to spaces and trim trailing spaces.
2020-04-05 07:27:27 -07:00
Jeff Garland cb3bd50b90 make date-time all inline, additional constexpr fixes, clang 2a fix for boost 1.73 (#142)
* pull request to make date-time all inline (#135)

* remove legacy to_simple_string and prefer streaming in test code

* driveby fix to clean up self-assign compiler warnings in test code

* driveby fix to clean up unused variable compiler warnings in test code

* another update for issue #123 (constexpr) to allow time_duration constexpr to work

* final updates to make date_time free of library - issue #134

* add stub library for backward compatibility (#137)

* remove legacy to_simple_string and prefer streaming in test code

* driveby fix to clean up self-assign compiler warnings in test code

* driveby fix to clean up unused variable compiler warnings in test code

* another update for issue #123 (constexpr) to allow time_duration constexpr to work

* final updates to make date_time free of library - issue #134

* make a stub library for backward compatibility of libs that link date_time library

* suppressed const qualifier on function return type (#138)

* suppressed const qualifier on function return type

As warned in https://www.boost.org/development/tests/develop/output/teeks99-dkr-dg4-6-warn-date_time-gcc-4-6~c++0x~warn-warnings.html#hours_special_value
```../boost/date_time/gregorian/greg_weekday.hpp:52:41: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
../boost/date_time/gregorian/greg_weekday.hpp:61:40: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]```

* trivial commit to trigger CI

* fix c++2a ambiguity on clang10 with operator== issue #132 (#140)

Co-authored-by: joaquintides <joaquin.lopezmunoz@gmail.com>
2020-03-25 05:38:03 -07:00
Jeff Garland 4a46476358 fix c++2a ambiguity on clang10 with operator== issue #132 (#140) 2020-03-22 20:05:09 -07:00
joaquintides 44618f1632 suppressed const qualifier on function return type (#138)
* suppressed const qualifier on function return type

As warned in https://www.boost.org/development/tests/develop/output/teeks99-dkr-dg4-6-warn-date_time-gcc-4-6~c++0x~warn-warnings.html#hours_special_value
```../boost/date_time/gregorian/greg_weekday.hpp:52:41: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
../boost/date_time/gregorian/greg_weekday.hpp:61:40: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]```

* trivial commit to trigger CI
2020-03-19 08:16:47 -07:00
Jeff Garland bbac2178ed add stub library for backward compatibility (#137)
* remove legacy to_simple_string and prefer streaming in test code

* driveby fix to clean up self-assign compiler warnings in test code

* driveby fix to clean up unused variable compiler warnings in test code

* another update for issue #123 (constexpr) to allow time_duration constexpr to work

* final updates to make date_time free of library - issue #134

* make a stub library for backward compatibility of libs that link date_time library
2020-03-15 21:03:59 -07:00
Jeff Garland d8c7a59ed9 pull request to make date-time all inline (#135)
* remove legacy to_simple_string and prefer streaming in test code

* driveby fix to clean up self-assign compiler warnings in test code

* driveby fix to clean up unused variable compiler warnings in test code

* another update for issue #123 (constexpr) to allow time_duration constexpr to work

* final updates to make date_time free of library - issue #134
2020-03-15 04:27:39 -07:00
JeffGarland d8a894c44a fix merge conflicts 2020-03-14 10:28:43 -07:00
Jeff Garland 139f44776d date time misc cleanup (#131)
* remove superflous HAS_MICROSECOND and HAS_MILLISECOND macros

* remove pre 1_33 facet detection for dead compilers
2020-03-12 18:36:13 -07:00
Jeff Garland 6f7b2b5056 fix report of warnings for constexpr updates on gcc9 03 mode (#130) 2020-03-10 16:24:10 -07:00
Jeff Garland 4e1b7cde45 initial set of core changes for constexpr support (issue #123) (#126)
* initial set of core changes for constexpr support (issue #123)

* fixes for constexpr core support based on ci failures (issue #123)

* drive by fix for gcc9.2 warning on polymorphic exception

* fixes for constexpr core support based on for cpp11 and cpp14 build variants (issue #123)

* more fixes for constexpr core support  (issue #123) - also fix for issue #124

* next round of changes for constexpr core support (issue #123)

* fix last msvc regression for constexpr core

* driveby fix to remove detail include

* 3rd round of changes for constexpr

* yet another msvc fix for cpp14

* minor doc fix for issue #127 - tm_isddst -> tm_isdst

* minor doc fix for issue #127 - tm_isddst -> tm_isdst

* push constexpr deep into the library including date, ptime (issue #123)

* push constexpr deep into the library including date, ptime (issue #123)

* fix latests regressions from constexpr changes in older gcc
2020-03-05 06:46:35 -07:00
Jeff Garland e26fd2ed98 pull develop to master for boost 1.72 (#117)
* Synchronize each miscrosec test to the next second (#109)

* Synchronize each miscrosec test to the next second

The aim is to avoid false positives in test_microsec when the seconds,
minutes or hours change during time read between the second_clock and
the microsec_clock.

* Improved readability of the microcec_time_clock test

* Improve performance of adding and subtracting time durations from a ptime. (#99)

Modifying ptime objects by adding and subtracting time durations was
inefficient because it extracted the date and time of day and then
re-constructed a ptime using the date and modified time of day.

This can be avoided by using the existing time_system utilities which
perform the operation by adjusting the number of ticks.

Performance is improved by a factor of 48 on my system.

* Update CI Scripts

* Add time_duration helper functions: (#113)

1. is_positive()
  - Return boolean value to indicate whether or not time duration is
    positive.
2. is_zero()
  - Return boolean value to indicate whether or not time duration is
    zero.
3. abs()
  - Return a time_duration which is the absolute value of time
    duration.

Added documentation for these helper functions and improved existing
documentation to indicate constness, return values or static
functions.

* Cease dependence on MPL (#115)
2019-12-03 17:06:28 -07:00
Nikita Kniazev 061aec856d Cease dependence on MPL (#115) 2019-11-21 07:28:47 -07:00
Gawain Bolton 1a95e81043 Add time_duration helper functions: (#113)
1. is_positive()
  - Return boolean value to indicate whether or not time duration is
    positive.
2. is_zero()
  - Return boolean value to indicate whether or not time duration is
    zero.
3. abs()
  - Return a time_duration which is the absolute value of time
    duration.

Added documentation for these helper functions and improved existing
documentation to indicate constness, return values or static
functions.
2019-11-01 04:08:45 -07:00
James E. King III c0b71da135 Update CI Scripts 2019-10-14 16:42:18 -04:00
Gawain Bolton 2fabfad443 Improve performance of adding and subtracting time durations from a ptime. (#99)
Modifying ptime objects by adding and subtracting time durations was
inefficient because it extracted the date and time of day and then
re-constructed a ptime using the date and modified time of day.

This can be avoided by using the existing time_system utilities which
perform the operation by adjusting the number of ticks.

Performance is improved by a factor of 48 on my system.
2019-10-10 13:07:48 -07:00
cclienti 3cc68a4642 Synchronize each miscrosec test to the next second (#109)
* Synchronize each miscrosec test to the next second

The aim is to avoid false positives in test_microsec when the seconds,
minutes or hours change during time read between the second_clock and
the microsec_clock.

* Improved readability of the microcec_time_clock test
2019-10-08 07:17:01 -07:00
LE GARREC Vincent 29bb209464 Fix unsigned / signed conversion
gregorian_calendar::end_of_month_day returns unsigned short and date constructor uses unsigned short too.
2019-05-10 10:32:15 -04:00
Mana Borwornpadungkitti 345abc6b67 Fix a typo in example of time_duration xmldoc (#100) 2019-03-24 08:32:07 -07:00
ehrlin b0437e2999 Renamed parameter dst_length_minutes to dst_length. (#96) 2019-03-04 11:29:48 -05:00
Marcel Raad 5902a0e577 Fix doxygen clang warnings (#97)
* doxygen: use @tparam for template parameters (clang warns about using @param).
2019-02-25 15:27:45 -05:00
James E. King III c18805c4ba update cygwin on CI before building (#93) 2018-12-02 20:36:03 -07:00
James E. King III 81d60863b6 Enhance CI for more build coverage 2018-11-02 21:27:05 -04:00
James E. King III a3d61f0d30 Enhance Travis CI build coverage 2018-10-28 11:37:32 -04:00
Sylvain Joubert dc5ce19c27 Use nullptr instead of 0 if possible
This is to prevent gcc's -Wzero-as-nullptr-constant warnings
2018-09-06 07:22:34 -04:00
James E. King III 66ee8bf48f fix failing ci jobs in travis 2018-07-14 17:37:59 +00:00
James E. King III aa19739c55 move ci to boost-ci model 2018-06-17 07:23:14 -04:00
James E. King III f76ef169a0 make valgrind return error code on failure 2018-05-15 21:16:08 -04:00
James E. King, III fd5f9aea7c Work around a gcc-7.3 issue running ubsan on travis CI
https://stackoverflow.com/questions/50024731/ld-unrecognized-option-push-state-no-as-needed
2018-04-29 10:07:42 -04:00
James E. King, III 6875e73a03 Add license file 2018-04-29 10:06:38 -04:00
James E. King III 8e1f2be360 improve code coverage results processing 2018-03-07 15:17:47 -05:00
Andrey Semashev 1838518b41 Silence MSVC warnings about conditional expression being constant.
The warning is emitted whereever std::numeric_limits<>::is_signed is used
in a conditional statement.
2018-02-10 23:42:44 -05:00
James E. King III a7ec0146c7 Update README 2018-01-28 10:09:21 -05:00
James E. King III 9690a13c55 Update README 2018-01-28 10:08:41 -05:00
James E. King III 5a70608c65 add jking to maintainers list 2018-01-28 10:05:15 -05:00
James E. King III dae0fa1b47 quiet unused variable warnings in compile_fail tests 2018-01-28 10:04:59 -05:00
James E. King III 3f092da750 trac-13159, trac-12630: fix maximum year to 9999 2018-01-24 09:44:04 -05:00
James E. King III 960c959f10 update readme and link to boostdep 2018-01-23 18:19:38 -05:00
James E. King III 1a2700d527 fix issues identified by Coverity Scan 2018-01-23 17:57:36 -05:00
James E. King III 8b92513a94 trac-1078: given to_iso_string can print special values, make from_iso_string read them 2018-01-22 15:49:25 -05:00
James E. King III d8a1ed32fb add codecov.io, cppcheck, ubsan, and coverity scan support; refactor travis to use jobs 2018-01-21 20:14:06 -05:00
James E. King, III 313c1a38f8 Merge pull request #62 from jeking3/trac-3606
trac-3606: fix remaining msvc /W4 complaints (msvc-10.0 and up)
2018-01-17 22:10:35 -05:00
James E. King III e0da18162a trac-9882: fix gcc -Wshadow errors and warnings enabled by trac-3606 2018-01-17 09:22:22 -05:00
James E. King III f35bbbe906 trac-3606: fix remaining msvc /W4 complaints (msvc-10.0 and up) 2018-01-17 09:22:22 -05:00
James E. King III f280794280 fix mingw related build issues on appveyor 2018-01-16 14:27:16 -05:00
James E. King III 18b6ca8160 trac-11142: fix boost::date_time::period_parser::delimiter_strings and add a unit test for it
also added project declarations to jamfiles, added a top level jamfile, and fixed the xmldoc jamfile
also fixed a silent failure y2038 issue in localtime handling and fixed a timezone database parse issue
2018-01-16 12:46:45 -05:00
Edward Diener b1193100b0 Merge pull request #70 from jeking3/issue-56
issue-56: fix 32/64 bit test issue with previous fix
2018-01-07 16:24:22 -05:00
James E. King III e78132c031 issue-56: fix 32/64 bit test issue with previous fix 2018-01-07 11:23:14 -05:00
Edward Diener e4379f752e Merge pull request #68 from jeking3/trac-10087
trac-10087: update the time zone database to IANA 2016c
2018-01-07 10:22:15 -05:00
James E. King III d0aec34055 trac-10087: update the time zone database to IANA 2016c 2018-01-06 11:30:28 -05:00
Edward Diener 3c794d085a Catch any runtime exception which could occur when calling c_time:local_time. 2017-12-31 21:18:41 -05:00
Edward Diener 00ab3d7226 Merge pull request #64 from jeking3/trac-11168
trac-11168: special_values handling in time duration helpers
2017-12-31 00:42:27 -05:00
Edward Diener 6e3761271d Merge pull request #60 from jeking3/trac-12363
trac-12363: fix const correctness issue in operator implementations
2017-12-31 00:05:44 -05:00
Edward Diener 2bf11e74a2 Merge pull request #59 from jeking3/trac-12910
trac-12910: allow %j without a year specifier - uses epoch year
2017-12-30 23:32:49 -05:00
Edward Diener 53d5131244 Merge pull request #65 from jeking3/trac-12101
trac-12101: fix is_pos_infinity example
2017-12-30 23:23:10 -05:00
Edward Diener 73178412b0 Merge pull request #66 from jeking3/trac-12074
trac-12074: fix get_day_of_week documentation
2017-12-30 23:22:31 -05:00
Edward Diener 2e4a3010f0 Merge pull request #58 from jeking3/issue-56
issue-56: fix binary serialization compatibility problem with time_duration
2017-12-30 16:26:42 -05:00
James E. King III de171954fe Fix serialization problem with time_duration
This fixes #56
2017-12-29 23:38:44 -05:00
James E. King III 1a931e2f5e trac-12074: fix get_day_of_week documentation 2017-12-28 21:36:42 -05:00
James E. King III f302689484 trac-12101: fix is_pos_infinity example 2017-12-28 21:33:24 -05:00
James E. King III f9f2aaf521 trac-11168: ensure special values are not automatically translated to integral types in the hours, minutes, seconds, and fractional seconds time duration helpers 2017-12-28 14:44:01 -05:00
James E. King III af8832799f trac-12363: fix const correctness issue in operator implementations 2017-12-27 08:22:50 -05:00
James E. King III e87b7120ac trac-12910: allow %j without a year specifier - uses epoch year 2017-12-26 12:02:14 -05:00
Edward Diener 5d94c6d65d Updated appveyor file with more testing and using b2 cxxstd. 2017-12-23 15:04:08 -05:00
Edward Diener 313ba3be94 Merge pull request #54 from jeking3/trac-13194
trac-13194: fix time input facet processing for %e
2017-12-23 14:29:22 -05:00
Edward Diener 91e931cbc7 Merge pull request #57 from jeking3/fix-rogue-file
add a .gitignore file to ignore a file that a test creates
2017-12-22 17:01:21 -05:00
James E. King III 484c28d442 add a .gitignore file to ignore a file that a test creates 2017-12-22 16:22:58 -05:00
Edward Diener 78e7772ad5 Merge pull request #52 from jeking3/appveyor
Add Appveyor CI support
2017-12-22 08:28:36 -05:00
James E. King, III b3b6ddd5ba trac-13194: fix time input facet processing for %e 2017-12-22 08:02:24 -05:00
James E. King III 2f616517b5 Add Appveyor CI support 2017-12-20 19:48:02 -05:00
Peter Dimov f6ab5fc0fd Merge branch 'develop' 2017-12-18 18:36:49 +02:00
Peter Dimov afa1a44f97 Install libstdc++ 4.9 for clang to avoid ::gets error 2017-11-13 22:56:29 +02:00
Peter Dimov 53da52ee05 Bracket archive use to fix xml serialization test failures 2017-11-13 21:44:04 +02:00
Peter Dimov 2434bc8f4d Pass input files properly via the run rule 2017-11-13 21:20:41 +02:00
Peter Dimov f983eef46b Add .travis.yml 2017-11-13 20:38:26 +02:00
Edward Diener dcab4d2bfa Merge branch 'develop' 2017-11-10 10:06:44 -05:00
Edward Diener 3a5f651c30 Merge pull request #50 from Lastique/silence_msvc_warnings
Silence MSVC warnings about integer truncation
2017-11-05 02:04:11 -05:00
Edward Diener 26249ccbc0 Merge pull request #49 from Lastique/update_winapi
Update Boost.WinAPI usage to the new location and namespace
2017-11-04 20:41:16 -04:00
Andrey Semashev 405e66e7e7 Silence MSVC warnings about integer truncation.
Also for day/month/year types use the value_type typedef to accept and
return numeric values of the date component.
2017-10-25 00:14:17 +03:00
Andrey Semashev 5f2d1fad55 Updated Boost.WinAPI usage to the new location and namespace. 2017-10-24 21:45:07 +03:00
Edward Diener 805b89d987 Corrected warning by casting to the correct type. 2017-10-14 10:49:26 -04:00
Marshall Clow d9b355d2c2 Remove the need for static_cast by using the correct type 2017-09-12 17:24:46 -07:00
Edward Diener e86cc2c4d5 Merge pull request #46 from Lastique/silence_msvc_conversion_warnings
Silence MSVC warnings about possible integer truncation.
2017-09-05 18:06:53 -04:00
Edward Diener efa45ac4ed Merge branch 'develop' 2017-09-05 14:09:14 -04:00
Andrey Semashev da6038df30 Silence MSVC warnings about possible integer truncation. 2017-09-05 21:06:06 +03:00
Edward Diener 313ad06704 Merge pull request #45 from Lastique/port_to_winapi
Port to Boost.WinAPI and cleanup warnings
2017-08-28 15:14:24 -04:00
Andrey Semashev 8e2a8fdcb2 Adjust indentation to match the surrounding code. 2017-08-28 20:17:40 +03:00
Andrey Semashev 266e6cc8e1 Silence MSVC warnings about unused exception variables in tests. 2017-08-28 20:06:24 +03:00
Andrey Semashev b3a1f75376 Silence MSVC warning about possible integer truncation. 2017-08-28 20:05:46 +03:00
Andrey Semashev e9ddfa6400 Silence MSVC-8 bogus warning about possible integer truncation. 2017-08-28 19:43:08 +03:00
Andrey Semashev 1e844a3143 Ported Windows-specific time functions to Boost.WinAPI. 2017-08-28 19:00:18 +03:00
Marshall Clow e46fda1c9e Merge PR 42/43/44 to master 2017-08-27 20:36:21 -07:00
Edward Diener e67bf74ac6 Merge pull request #44 from Lastique/fix_warnings
Fix warnings in tests
2017-08-11 09:25:46 -04:00
Andrey Semashev 6b3452954e Silenced clang warning about unused variable. 2017-08-11 16:10:00 +03:00
Andrey Semashev 587a677ebc Limit the warning-related pragmas to MSVC, clang and gcc specifically. 2017-08-11 16:04:16 +03:00
Andrey Semashev d3986cf902 Silence warnings about signed/unsigned mismatch in comparison operators. 2017-08-10 19:08:58 +03:00
Andrey Semashev 82f61328b2 Fixed "invalid character" warnings from clang.
The character was indeed not a valid UTF-8 character. Presumably, it is a
valid character in some national encoding, but Unicode is ubiquitous nowdays
and the compiler is not able to know the encoding anyway. Thus the commit
converts the character to a hex-escaped UTF-8 representation of character
U+00FC ('ü').
2017-08-10 19:01:45 +03:00
Marshall Clow cbcb9923e7 Merge pull request #43 from Lastique/expand_years_overflow_test_range
Expand range of values in years overflow test
2017-08-08 09:34:34 -07:00
Andrey Semashev d972d0cd69 Expand range of values in years overflow test to ensure the whole documented range is allowed. 2017-08-08 19:32:08 +03:00
Marshall Clow 7cf4f75e74 Merge pull request #42 from Lastique/fix_years_overflow2
Fixed integer overflow when subtracting many years to a gregorian date.
2017-08-08 07:47:47 -07:00
Andrey Semashev 6af6215e9e Fixed integer overflow when subtracting many years to a gregorian date.
Also added a testcase to detect the overflow.
2017-08-08 17:42:51 +03:00
Marshall Clow 2f1b24518e Merge pull request #41 from Lastique/fix_years_overflow
Fixed integer overflow when adding many years to a gregorian date.
2017-08-08 07:30:03 -07:00
Andrey Semashev 729af79cc5 Fixed integer overflow when adding many years to a gregorian date.
Also added a testcase to detect the overflow.
2017-08-08 17:23:46 +03:00
Edward Diener 24d297ba79 Merge branch 'master' of https://github.com/boostorg/date_time 2017-06-23 22:43:09 -04:00
Edward Diener 8cc821fa9b Merge branch 'develop' 2017-06-23 22:42:41 -04:00
Marshall Clow 5459990493 Bug fixes for the 1.65.0 release 2017-06-14 18:37:57 -07:00
Edward Diener 786b9eb948 Merge pull request #38 from pgroke-dt/zOS-workaround
workaround for z/OS compiler (define BOOST_DATE_TIME_NO_LOCALE)
2017-05-06 20:00:17 -04:00
Paul Groke 5974bdcbb9 workaround for z/OS compiler (define BOOST_DATE_TIME_NO_LOCALE) 2017-05-05 18:11:02 +02:00
Edward Diener 4e31167489 Merge pull request #37 from DanielaE/fix/narrowing-warnings
fix narrowing warnings
2017-04-27 19:15:38 -04:00
Daniela Engert b1dc2b306e fix narrowing warnings
Signed-off-by: Daniela Engert <dani@ngrt.de>
2017-04-26 14:03:45 +02:00
Edward Diener 8c85874006 Merge branch 'develop' 2017-04-24 12:47:42 -04:00
Edward Diener 1388380be8 Merge pull request #35 from jeking3/boost-trac-4543
4543: fix ptime 2038 issue
2017-03-28 16:56:48 -04:00
Marshall Clow 8e299776fa Merge pull request #36 from jurko-gospodnetic/fix-example-folder-path-in-docs
correct example folder path in docs from `examples/` to `example/`
2017-03-21 09:13:10 -07:00
Jurko Gospodnetić f690b29348 correct example folder path in docs from examples/ to example/ 2017-03-21 16:51:33 +01:00
James E. King, III 818dea52f3 4543: fix ptime 2038 issue 2017-02-21 16:37:53 -05:00
Edward Diener 9817537a2c Merge branch 'develop' 2017-01-04 12:41:22 -05:00
Edward Diener 47cf10d5fd Merge pull request #27 from Lastique/facets_visibility
Add support for hidden visibility
2016-12-03 02:11:50 -05:00
Marshall Clow 1e71530fb4 Merge changes from develop for the 1.63.0 release 2016-11-30 12:42:30 -08:00
Edward Diener 51659e3404 Corrected use of config macro 2016-11-07 00:12:38 -05:00
Edward Diener 22a3727798 Replace auto_ptr with unique_ptr when it is appropriate. 2016-11-06 21:01:54 -05:00
K. Noel Belcourt ef8fa5b5d5 Add declaration of to_iso_string in boost::gregorian namespace.
Should fix include order issue.
2016-11-03 13:53:13 -06:00
Rene Rivera 8e45258f00 Add, and update, documentation build targets. 2016-10-10 11:39:48 -05:00
Rene Rivera e6050c81e6 Add, and update, documentation build targets. 2016-10-07 23:07:33 -05:00
Marshall Clow f4c2ca351b Merge to master for 1.62.0 release 2016-08-17 13:06:44 -07:00
Edward Diener 6015e30391 Merge pull request #33 from ledocc/develop
add from_iso_extended_string
2016-07-12 17:01:27 -04:00
David Callu ee4ceddc52 add posix_time::from_iso_extended_string 2016-05-26 21:15:13 +02:00
Marshall Clow d20ad3083e Merge pull request #32 from saschazelzer/time_input_facet_format_string
#12180 Avoid dereferencing the input string iterator in the fall-through case.
2016-05-09 07:14:51 -06:00
Sascha Zelzer e37ce12d57 Avoid dereferencing the input string iterator in the fall-through case. 2016-05-06 12:03:34 +02:00
Marshall Clow 6cad962159 Merge branch 'develop' 2015-11-04 19:59:11 -08:00
Edward Diener a742fcbffd Merge pull request #24 from joachim-faulhaber/date_time_patches_1_59_0_v1
Warning fixes for conversion warnings
2015-10-17 00:27:44 -04:00
Edward Diener 9fbd8db5c9 Merge pull request #23 from joachim-faulhaber/date_time_patches_1_59_0
Warning fixes for conversion warnings
2015-10-17 00:27:18 -04:00
Andrey Semashev bd3973017c Added visibility attributes to exceptions, date, time and other associated types to ensure the facets have the default visibility. 2015-10-04 22:09:09 +03:00
Andrey Semashev 73de7bc29f Added visibility attributes for facets. 2015-10-04 17:57:19 +03:00
Edward Diener d7673dddb9 Merge pull request #26 from joachim-faulhaber/date_time_patches_1_59_0_v2
Date time patches 1 59 0 v2: Integer conversion warning fix
2015-09-23 08:22:06 -07:00
Joachim Faulhaber 03c419d8b6 Corrected warning fix: added static cast 2015-09-23 16:12:10 +02:00
Joachim Faulhaber 350dc3342d Corrected warning fix: added static cast 2015-09-23 16:07:12 +02:00
Joachim Faulhaber d5041e7075 Corrected warning fix: added static cast 2015-09-23 16:02:47 +02:00
Joachim Faulhaber 6d09aabddc Corrected warning fix: paren mismatch 2015-09-23 15:54:22 +02:00
Joachim Faulhaber 75176687d7 Warning fix: Implicit conversion loses integer precision. 2015-09-22 13:50:16 +02:00
Joachim Faulhaber 1519c8784e Warning fixes for conversion warnings 2015-09-22 13:01:50 +02:00
Joachim Faulhaber 86703c4df9 Warning fixes for conversion warnings 2015-09-21 17:45:12 +02:00
Daniel James 75d979c03a Merge remote-tracking branch 'origin/develop' 2015-03-03 22:19:01 +00:00
Marshall Clow f1f27d9a55 Apply pull request #22 manually; Fixes #10014 2015-03-01 13:38:04 -08:00
Marshall Clow b13b2a2b42 Patch from alexhenrie to fix spelling mistake in comment 2015-02-01 16:40:38 -08:00
Marshall Clow ca30f6a01e Documentation patch from 'faithandbrave' 2014-11-18 06:21:59 -08:00
Noel Belcourt 2c3a8b21b9 Merge pull request #18 from danieljames/metadata
Create metadata file.
2014-11-02 16:13:10 -07:00
Daniel James 7002518d0f Add metadata file. 2014-08-18 14:58:29 +01:00
Marshall Clow 79ea55aae4 Merge pull request #17 from ibmsoe/aix_fix
Renamed variable v_type to var_type so it longer conflicts with an AIX system variable.
2014-08-08 09:16:04 -07:00
Axel Ismirlian e9c5af3c45 Renamed variable v_type to var_type so it no longer conflicts with the definition of an AIX system variable. 2014-08-08 10:47:45 -05:00
Noel Belcourt b43dd52cdc Merge pull request #14 from danieljames/lexical-cast-link
Update link to lexical_cast.
2014-06-25 13:14:11 -06:00
Daniel James e4f4a89339 Update link to lexical cast. 2014-06-16 11:15:38 +01:00
Noel Belcourt f1f69e1c78 Merge pull request #13 from Lastique/develop
Restored to_time_t() function
2014-06-02 11:08:31 -06:00
Andrey Semashev ae536816ee Restored to_time_t() function removed by commit 6636f49f13. 2014-05-31 20:46:36 +04:00
Daniel James 6cc1cb5ae5 Merge pull request #12 from Lastique/develop
Fix Boost.Sync tests breakage.
2014-05-31 15:12:47 +01:00
Andrey Semashev 805bf4dffe Added comments to the type tags. 2014-05-31 17:49:52 +04:00
Andrey Semashev 1753a38289 Fix Boost.Sync tests breakage.
Re-add date/time type tags removed by commit 6636f49f13. These tags are used by Boost.Sync to categorize different date/time types.
2014-05-31 17:13:25 +04:00
K. Noel Belcourt a403bdac5b Merge branch 'develop' 2014-05-09 20:36:27 -06:00
K. Noel Belcourt 6636f49f13 Merge branch 'master' into develop 2014-05-09 20:36:03 -06:00
Noel Belcourt 98d1ae6536 Merge pull request #9 from danieljames/timezone-test
Add some automatic checks to testc_local_adjustor.

Seems okay to me, thanks!
2014-05-03 11:04:00 -06:00
Marshall Clow 23f7406095 Merge pull request #10 from maksqwe/unused_fix
Remove unused locale variable
2014-04-15 06:21:03 -07:00
Maks Naumov 2df204ba78 remove unused variable in tz_db_base::load_from_file() 2014-04-15 16:08:11 +03:00
Daniel James 6f82742918 Add some automatic checks to testc_local_adjustor.
Not full tests, but enough to catch the error fixed in
344c0dceb4.
2014-04-07 22:30:38 +01:00
Daniel James c32726ec7e Merge pull request #8 from mingulov/patch-1_1
#else/#endif comments are updated accordingly to the used condition
2014-03-25 15:05:14 +00:00
Denis Mingulov 9ad0419530 #else/#endif comments are updated accordingly to the used condition
Fixed incorrect comments for the condition at the next line:
#if defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS)
There were later:
#else // BOOST_HAS_THREADS
#endif // BOOST_HAS_THREADS
It prevented a proper fast undesrstanding of the source.
2014-03-24 08:41:16 +02:00
Marshall Clow ffe85c7d4b Merge branch 'develop' of github.com:boostorg/date_time into develop 2014-03-15 08:53:40 -07:00
Marshall Clow 21a29b977b Clarified the docs and examples for previous_weekday and next_weekday. Refs #5753. 2014-03-15 08:53:14 -07:00
Marshall Clow ef81faff5f Added test for bug #5041 - %y in single digit year
Ahmed Charles: Tests pass with MSVC 2013.
2014-03-13 15:08:38 -07:00
Marshall Clow 4d44fae9ac Merge pull request #2 from DanielaE/feature/qoi-warnings
Suppress msvc level-4 warnings.
2014-03-12 08:29:22 -07:00
Marshall Clow f9d548ae92 Create first merge point for git 2014-03-12 08:24:18 -07:00
Andrey Semashev f42e7f6287 Fixed locally defined but not unused typedef warnings on GCC.
Passes tests.
2014-03-02 01:30:52 -08:00
Daniela Engert c4abfc8cbb Suppress msvc level-4 warnings.
Even when compiled at warning level 4 (i.e. all), project policies may require compilations without warnings issued.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2014-02-07 18:17:40 +01:00
Noel Belcourt 344c0dceb4 Merge pull request #4 from MarcelRaad/patch-1
Fix for utc_to_local year 2038 problem
2014-02-06 20:32:28 -07:00
Noel Belcourt 30e7e7ae46 Merge pull request #1 from DanielaE/fix/bad_narrow
fix: narrow uses insufficient input char type
2014-02-06 20:23:53 -07:00
Marcel Raad c88efdea68 Fix for utc_to_local year 2038 problem
Even if std::time_t is 64-bit, multiplying the 32-bit value dd.days() by 86400 result in a negative value for dates after 2038. This results in c_time::localtime(&t2, &tms) throwing an exception.

Adding casts to std::time_t fixes this problem.
2014-01-20 13:26:43 +01:00
Daniela Engert ad1899abd9 fix: narrow uses insufficient input char type
The current implementation uses std::stringstream::narrow(char) with its 'char' input parameter type to transform 'charT' chars taken from a std::basic_istream<charT> into 'char' chars. This is most likely not what is intended if 'charT' is wider than 'char'. Fix this by using std::basic_istream<charT>::narrow(charT) instead.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2013-12-30 17:41:34 +01:00
Marshall Clow 057e0aaf64 Merge DateTime bug fix to Release; Fixes #9216
[SVN r86322]
2013-10-15 15:22:02 +00:00
Marshall Clow 072b4e1b61 Fix several 'iterating past the end' bugs in Boost.DateTime; Refs #9216
[SVN r86230]
2013-10-10 15:43:31 +00:00
Stephen Kelly fe1f823e3a DateTime: Remove obsolete GCC version checks.
[SVN r86108]
2013-10-01 08:43:14 +00:00
Stephen Kelly dee09f0e62 DateTime: Remove obsolete MSVC version check.
[SVN r86027]
2013-09-30 00:18:55 +00:00
Stephen Kelly af581a1f2a DateTime: Remove obsolete MSVC version checks.
[SVN r85905]
2013-09-25 13:52:11 +00:00
Andrey Semashev 71ccdd2fe5 Added tags for integration with Boost.Sync.
[SVN r85672]
2013-09-15 10:21:59 +00:00
Marshall Clow d123f62bdc Merge fix for C++11 compilation error
[SVN r85045]
2013-07-15 13:55:21 +00:00
Marshall Clow 98f041d7fd Merge bug fixes to release. Fixes #6136. Fixes #5550
[SVN r84860]
2013-06-21 15:04:12 +00:00
Marshall Clow 990187b70c Fixed more compiler warnings; Refs #5550
[SVN r84835]
2013-06-19 15:36:32 +00:00
Marshall Clow 0054ff1ab7 Fixed more compiler warnings; Refs #6136
[SVN r84834]
2013-06-19 15:25:05 +00:00
Marshall Clow 0764743fb9 Apply patch to release branch; Fixes #8391
[SVN r84755]
2013-06-13 14:00:48 +00:00
Marshall Clow 250b88cfb5 Removed extraneous return-unreachable introduced in [84645]
[SVN r84647]
2013-06-05 20:16:21 +00:00
Marshall Clow d9874a3140 More error checking on tz files; Refs #8391
[SVN r84645]
2013-06-05 20:04:10 +00:00
Marshall Clow 47c81a9033 In C++11 the shared_ptr -> bool conversion is explicit. In custom time zone code, make the cast explicit. Fixes compilation failure in C++11
[SVN r84626]
2013-06-04 04:34:29 +00:00
Jürgen Hunold 5e009f6002 untabify to adjust to style of the rest of the file
[SVN r84290]
2013-05-15 09:14:11 +00:00
Jürgen Hunold 9454bb4e1c add inline to avoid duplicate symbol warnings
[SVN r84289]
2013-05-15 09:13:17 +00:00
Marshall Clow 5126bfbc0a Added missing call 'to_time_t' (and tests)
[SVN r84284]
2013-05-14 21:22:01 +00:00
Andrey Semashev 6bbd9f50bc Merged changes from trunk. Fixes #3471.
[SVN r80940]
2012-10-10 19:05:03 +00:00
Andrey Semashev 98bbc0b95c Fixed compilation with MinGW.
[SVN r80890]
2012-10-06 17:54:32 +00:00
Andrey Semashev 29c0f85c14 Fixed compilation with MSVC.
[SVN r80889]
2012-10-06 17:46:27 +00:00
Andrey Semashev 11974f29b2 Refs #3471. Precompute the duration conversion coefficient to avoid integer overflow. Added a test for integer overflow in the subsecond duration constructor.
[SVN r80887]
2012-10-06 17:34:06 +00:00
Marshall Clow 365c29f1a1 Merge bug fixes to release; Fixes #5550 Fixes #6136 Fixes #6513 Fixes #7111 Fixes #7112 Fixes #7113 Fixes #7342 Fixes #7426
[SVN r80797]
2012-09-30 23:25:22 +00:00
Marshall Clow 2e31c3b92e Commented out unused parameters in date-time; Refs #7426
[SVN r80722]
2012-09-27 14:24:15 +00:00
Marshall Clow db1f46894e Use memset instead of default constructor (std::tm) for deficient compilers; Refs #5550
[SVN r80710]
2012-09-26 16:57:58 +00:00
Marshall Clow 318a6ce7ea Fix typo in test case; Refs #6513
[SVN r80709]
2012-09-26 16:44:40 +00:00
Marshall Clow 2da515b579 Added default case labels to silence bogus warnings; Refs #7112; Refs #7113
[SVN r80708]
2012-09-26 16:22:04 +00:00
Marshall Clow e86d5f310f Added default case label to silence bogus warning; Refs #7111
[SVN r80703]
2012-09-25 19:08:40 +00:00
Marshall Clow 7ce2128b11 Remove unused variable; Refs #7342 Refs #6136
[SVN r80699]
2012-09-24 21:41:06 +00:00
Marshall Clow 4a5c1d20a3 Merge bug fix to trunk; fixes #7022
[SVN r80697]
2012-09-24 18:08:16 +00:00
Vicente J. Botet Escriba 7b1b5aa452 DateTime: merge [80051]
[SVN r80648]
2012-09-22 22:33:33 +00:00
Daniel James 693c89198f Merge some old datetime changes to release
- [70756] Convert jamfile for examples to boost build v2.
- [79211][79212] Suppress g++4.6 warnings in tests.
- Document NO LIB option. Fixes #6077.


[SVN r80629]
2012-09-22 16:21:43 +00:00
Marshall Clow 006adfaa84 Merge doc typo corrections to release; fixes #6595; fixes #7182
[SVN r80057]
2012-08-16 05:16:42 +00:00
Marshall Clow 2dd066d92c Fix typo in docs; Refs #7182
[SVN r80055]
2012-08-16 03:52:00 +00:00
Vicente J. Botet Escriba f0381aab02 DateTime: apply patch to manage with #7234
[SVN r80051]
2012-08-15 17:06:56 +00:00
Marshall Clow 9b94605972 Merge greg_year serialization changes to release; fixes #3633
[SVN r79539]
2012-07-15 16:49:32 +00:00
Marshall Clow e6515ce73c Refs #3633; will close when merged to release
[SVN r79228]
2012-07-02 15:14:03 +00:00
Jeff Garland a6bca8a4a5 fix for ticket 6077 -- document the NO LIB option
[SVN r79213]
2012-07-01 18:58:59 +00:00
Jeff Garland 97c2acd867 minor updates to suppress g++4.6 warnings
[SVN r79212]
2012-07-01 17:04:48 +00:00
Jeff Garland c2861c6305 minor updates to suppress g++4.6 warnings
[SVN r79211]
2012-07-01 16:52:34 +00:00
Marshall Clow 75c53e7b75 Refs #7022; will close when merged to release
[SVN r79186]
2012-06-30 15:31:33 +00:00
Jürgen Hunold 2490f1c985 Merge 73299,73301,73308 from ^/trunk
------------------------------------------------------------------------
r73299 | jhunold | 2011-07-22 14:08:03 +0200 (Fr, 22 Jul 2011) | 2 lines

Enable visibility support. Refs #2114.

------------------------------------------------------------------------
r73301 | jhunold | 2011-07-22 16:15:45 +0200 (Fr, 22 Jul 2011) | 2 lines

Enable visibility support. Refs #2114.

------------------------------------------------------------------------
r73308 | jhunold | 2011-07-23 11:24:35 +0200 (Sa, 23 Jul 2011) | 2 lines

Enable visibility support. Refs #2114.

------------------------------------------------------------------------


[SVN r73381]
2011-07-26 17:40:21 +00:00
Jürgen Hunold c81a7f7f0c Enable visibility support. Refs #2114.
[SVN r73301]
2011-07-22 14:15:45 +00:00
Marshall Clow 7f89ef42b6 Merge fixes to release; Fixes #1674
[SVN r72330]
2011-06-01 15:55:38 +00:00
Marshall Clow 72eb4479ea Merge fixes to release; Fixes #2475
[SVN r72329]
2011-06-01 15:52:09 +00:00
Marshall Clow 77d6aa82bb Applied patch; refs #1674
[SVN r72132]
2011-05-24 15:11:37 +00:00
Marshall Clow dbc9491a32 added 'load_from_stream'; refs #2475
[SVN r71720]
2011-05-04 19:54:36 +00:00
Marshall Clow bd7d632c66 Merge fixes to release; Fixes #1988
[SVN r71676]
2011-05-02 20:56:53 +00:00
Marshall Clow 2303ba2fbc Renamed BOOST_NO_THREADEX -> BOOST_HAS_THREADEX and BOOST_NO_GETSYSTEMTIMEASFILETIME --> BOOST_HAS_GETSYSTEMTIMEASFILETIME - Refs #1988
[SVN r71533]
2011-04-27 15:51:07 +00:00
Marshall Clow 0872610990 Merge fixes to release; Fixes #5126
[SVN r71250]
2011-04-14 15:58:01 +00:00
Marshall Clow e5ccaeb9e8 Merge fixes to release; Fixes #4411 Fixes #4574
[SVN r71249]
2011-04-14 15:51:59 +00:00
Marshall Clow a77b19d9d7 Applied patch; Refs #4870
[SVN r71191]
2011-04-11 18:20:53 +00:00
Marshall Clow 1e00a75273 Applied patch; Refs #5126
[SVN r71190]
2011-04-11 18:09:59 +00:00
Marshall Clow 9bb7d42086 Applied patch; Refs #4754 Refs #4411
[SVN r71186]
2011-04-11 15:05:23 +00:00
Marshall Clow 88c18beb87 Merge date/time fixes to release. Fixes #4920
[SVN r70987]
2011-04-04 23:53:07 +00:00
Marshall Clow 7052c3c5f7 Merge date/time fixes to release. Fixes #5345
[SVN r70986]
2011-04-04 23:47:20 +00:00
Marshall Clow abdd3169e4 Merge date/time fixes to release. Fixes #5250
[SVN r70985]
2011-04-04 23:45:08 +00:00
Marshall Clow f049671aa3 Merge date/time fixes to release. Fixes #4952
[SVN r70984]
2011-04-04 23:42:42 +00:00
Marshall Clow 20286c8d74 Merge date/time fixes to release. Fixes #4798
[SVN r70983]
2011-04-04 23:39:00 +00:00
Marshall Clow 6baaaaf783 Merge date/time fixes to release. Fixes #4475
[SVN r70982]
2011-04-04 23:33:53 +00:00
Marshall Clow 6d73f377d3 Merge to release. Fixes #3651 Fixes #4845
[SVN r70981]
2011-04-04 23:29:42 +00:00
Marshall Clow 2f18c57465 Applied modified patch - Refs #4798
[SVN r70780]
2011-03-31 13:32:46 +00:00
Marshall Clow 39fc9958ce Applied patch - Refs #5345
[SVN r70770]
2011-03-30 22:27:06 +00:00
Marshall Clow 2869d0f722 Applied patch - Refs 5250
[SVN r70769]
2011-03-30 22:26:36 +00:00
Marshall Clow 6b7e271ba8 Applied patch - Refs #4952
[SVN r70768]
2011-03-30 22:25:58 +00:00
Marshall Clow 7f0f89d624 Applied patch - Refs #4475
[SVN r70767]
2011-03-30 22:25:25 +00:00
Marshall Clow b498fbdd1b Applied patches - Refs #3651 Refs #4845
[SVN r70766]
2011-03-30 22:22:15 +00:00
Marshall Clow bc68ffd15b Updated examples - Refs #4920
[SVN r70765]
2011-03-30 22:21:18 +00:00
Jürgen Hunold a856c75856 convert to Boost.Build V2
[SVN r70756]
2011-03-30 19:25:08 +00:00
Steven Watanabe 5c9a890972 Revert [67111] (addition of boost/detail/iomanip.hpp) and all the commits that depend on it. ([68137], [68140], [68141], [68154], and [68165]).
[SVN r68168]
2011-01-15 08:11:51 +00:00
Bryce Adelstein-Lelbach d444c164c2 Replacing the use of <iomanip> with <boost/detail/iomanip.hpp> across Boost.
On Linux, GNU's libstdc++, which is the default stdlib for icc and clang,
cannot parse the <iomanip> header in version 4.5+ (which thankfully neither
compiler advises the use of yet), as it's original C++98-friendly
implementation has been replaced with a gnu++0x implementation.
<boost/detail/iomanip.hpp> is a portable implementation of <iomanip>, providing
boost::detail::setfill, boost::detail::setbase, boost::detail::setw,
boost::detail::setprecision, boost::detail::setiosflags and
boost::detail::resetiosflags. 



[SVN r68140]
2011-01-14 02:35:58 +00:00
Eric Niebler e524b7b26b Merged revisions 66495 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r66495 | eric_niebler | 2010-11-11 14:58:13 -0500 (Thu, 11 Nov 2010) | 1 line
  
  add missing serialization/nvp.hpp header
........


[SVN r66497]
2010-11-11 20:19:38 +00:00
Eric Niebler a161660022 add missing serialization/nvp.hpp header
[SVN r66495]
2010-11-11 19:58:13 +00:00
Daniel James df5886f64e Merge a couple of old documentation fixes for date_time.
[SVN r66268]
2010-10-30 13:38:25 +00:00
Daniel James 2c8be13241 Mergeinfo for libs/date_time and clean up whitespace differences with trunk.
[SVN r66267]
2010-10-30 13:34:37 +00:00
Daniel James 85d61ef073 Fix some links in date_time.
[SVN r63388]
2010-06-27 16:38:50 +00:00
Daniel James 80ffd14c8c Merge documentation fixes.
* Use `doc/src/*.css` instead of `doc/html/*.css`.
* Remove wiki and people directories.
* Some documentation fixes.
* Left out `minimal.css` changes and boostbook changes because of clashes.


[SVN r63347]
2010-06-26 12:30:09 +00:00
Daniel James aa1b72b62a Update various libraries' documentation build.
Mostly to use the images and css files under doc/src instead of
doc/html, usually be deleting the settings in order to use the defaults.
Also add 'boost.root' to some builds in order to fix links which rely on
it.

[SVN r63146]
2010-06-20 18:00:48 +00:00
Andrey Semashev 836b5faa3e Fixes #4154. Added iterator validity checks. If TZ string is not valid, the time zone constructor throws instead of crashing.
[SVN r62751]
2010-06-10 17:24:38 +00:00
Andrey Semashev e8561914b1 Refs #4154. Added iterator validity checks. If TZ string is not valid, the time zone constructor throws instead of crashing.
[SVN r62685]
2010-06-09 19:29:47 +00:00
Andrey Semashev 4e56397de2 Silence silly GCC warnings. Fixes #3563.
[SVN r62682]
2010-06-09 18:10:13 +00:00
Andrey Semashev 116869304c Silence silly GCC warnings. Refs #3563.
[SVN r62681]
2010-06-09 18:09:32 +00:00
Andrey Semashev 565d7d13a8 Silence the warnings. Fixes #3591.
[SVN r62677]
2010-06-09 17:41:14 +00:00
Andrey Semashev 4db9fc1777 Silence the warnings. Refs #3591.
[SVN r62676]
2010-06-09 17:40:23 +00:00
Andrey Semashev 3a779defdb Added inline qualifiers. Fixes #3647.
[SVN r62674]
2010-06-09 17:36:07 +00:00
Andrey Semashev 5bad0e79de Added inline qualifiers. Refs. #3647.
[SVN r62673]
2010-06-09 17:35:16 +00:00
Andrey Semashev a3e84e42be Merged changes from trunk (rev. 62450). Fixes #3876.
[SVN r62669]
2010-06-09 16:39:31 +00:00
Andrey Semashev 2cf2957cd5 Merged changes from trunk (rev. 62450). Fixes #3876.
[SVN r62667]
2010-06-09 16:33:36 +00:00
Andrey Semashev 901cb1fd20 Refs #3876. Made format flags %T and %R to be processed by the library in order to support them on more platforms. Also marked some flags that are known to have similar problems in the docs.
[SVN r62450]
2010-06-05 17:09:37 +00:00
Andrey Semashev b85f86f35e Fixes #2757. Added explicit casts to avoid warnings on MSVC.
[SVN r61892]
2010-05-10 09:15:48 +00:00
Andrey Semashev 3fce52f4e3 Refs #2757. Added explicit casts to avoid warnings on MSVC.
[SVN r61293]
2010-04-15 15:23:56 +00:00
Daniel James 149e759f06 Fix some whitespace differences between trunk and release.
[SVN r58878]
2010-01-10 19:17:23 +00:00
Andrey Semashev 3d472009f2 Committed changes for 1.41.
[SVN r57851]
2009-11-22 22:07:24 +00:00
Andrey Semashev 98d8bd1ded Committed changes for 1.41.
[SVN r57849]
2009-11-22 21:51:12 +00:00
Marshall Clow 73e55ee157 Fixes bug 2708
[SVN r57844]
2009-11-22 17:08:22 +00:00
Troy D. Straszheim 09b0c7c183 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
Troy D. Straszheim 0d90e990da rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
Andrey Semashev 865feda955 Fixes #3470. Merged from trunk revision 56548.
[SVN r56549]
2009-10-03 10:22:58 +00:00
Andrey Semashev 0255dcd796 Refs #3470. Modified documentation for c_time functions to reflect the actual behavior.
[SVN r56548]
2009-10-03 10:21:08 +00:00
Andrey Semashev cbd73eb665 Fixes #1861, #2213 merged from trunk.
[SVN r56545]
2009-10-03 10:04:00 +00:00
Andrey Semashev 4558ebe892 Docs updated according to fixes for tickets #1861 and #2213.
[SVN r56507]
2009-10-01 20:22:04 +00:00
Andrey Semashev 9be8ef4831 Refs #1861. Changed the default format for time durations to "%-%O:%M:%S%F" instead of "%-%H:%M:%S%F".
[SVN r56506]
2009-10-01 20:19:50 +00:00
Andrey Semashev 4ebe9e7979 Refs #2213. Fixed UTC zone offset boudaries.
[SVN r56505]
2009-10-01 19:43:55 +00:00
Andrey Semashev 7b3b24632e Fixes #3308. Also added some missing includes.
[SVN r56456]
2009-09-28 18:10:02 +00:00
Andrey Semashev 820a0b311f Added some missing includes.
[SVN r56384]
2009-09-25 19:39:08 +00:00
Andrey Semashev e229437b9e Refs #3308. Fixed calculation of difference between dates on 64 bit platforms.
[SVN r56372]
2009-09-24 20:21:37 +00:00
Andrey Semashev fa0df44386 Refs #3308. Changed the internal type of the gregorian dates to 32 bit integer.
[SVN r56338]
2009-09-21 15:27:52 +00:00
John Maddock 5851351380 Fix up logic and date_time Jamfiles so they build needed dependencies.
Fix PDF image paths in fusion Jamfile.v2.
Add fusion to the PDF build.

[SVN r55757]
2009-08-24 10:31:43 +00:00
Daniel James 84ae903714 Add depencies on doxygen documentation to standalone documentation targets.
This seems to be needed for building pdfs.

[SVN r55729]
2009-08-23 10:07:25 +00:00
Troy D. Straszheim 525b5dcf4c Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
Troy D. Straszheim f4f2c6dd81 Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
Andrey Semashev 69592d46fe Added recent changes.
[SVN r53681]
2009-06-06 11:29:34 +00:00
Andrey Semashev 87dab33026 Added recent changes.
[SVN r53680]
2009-06-06 11:29:09 +00:00
Andrey Semashev 8184015b34 Fixes #3015.
[SVN r53679]
2009-06-06 11:27:35 +00:00
Andrey Semashev dddbec8577 Fixes #2824.
[SVN r53678]
2009-06-06 11:25:55 +00:00
Andrey Semashev 94fe1d551e Fixes #2809.
[SVN r53677]
2009-06-06 11:24:09 +00:00
Andrey Semashev f985c62668 Changed tick_per_second constant type to avoid possible value truncation. Related to #2824.
[SVN r53632]
2009-06-04 12:18:59 +00:00
Andrey Semashev 9496e6ba33 Fixes #3094.
[SVN r53631]
2009-06-04 11:52:28 +00:00
Andrey Semashev b0d4735d98 Fixes #3094.
[SVN r53630]
2009-06-04 11:52:06 +00:00
Andrey Semashev e5d7b20d17 The std::tm instances are zero initialized before usage. Related to #1859.
[SVN r53629]
2009-06-04 11:40:18 +00:00
Andrey Semashev a7d470ff86 Fixes #3105.
[SVN r53628]
2009-06-04 11:36:43 +00:00
Andrey Semashev 024f7bb976 Fixes #3105.
[SVN r53627]
2009-06-04 11:35:44 +00:00
Andrey Semashev 7f908f13d9 Added explicit include of special_defs.hpp.
[SVN r53626]
2009-06-04 11:29:04 +00:00
Andrey Semashev 0970985b80 Fixes #3015.
[SVN r53625]
2009-06-04 11:22:11 +00:00
Andrey Semashev ec094bd865 The std::tm instances are zero initialized before usage. Related to #1859.
[SVN r53624]
2009-06-04 11:18:56 +00:00
Andrey Semashev 72e2a74cb9 Fixes #2809.
[SVN r53622]
2009-06-04 10:07:42 +00:00
Andrey Semashev df3999c141 Fixes #2710.
[SVN r53621]
2009-06-04 09:48:01 +00:00
Andrey Semashev ee7665b716 Fixes #2710.
[SVN r53620]
2009-06-04 09:47:12 +00:00
Andrey Semashev 1510fb009d Merged fixes for #287, #1859 and partially #1861. Improved diagnostics in case of test failures.
[SVN r53618]
2009-06-04 08:24:49 +00:00
Andrey Semashev 3e558911e4 Optimized the from_stream_type function. In case if no locales support available the code was modified to fix possible character code truncation. Related to #287.
[SVN r53529]
2009-06-01 09:51:34 +00:00
Andrey Semashev 8e9f05161d Improved diagnostics in case of test failure.
[SVN r53528]
2009-06-01 09:02:43 +00:00
Andrey Semashev d1877bf9de Added missing include
[SVN r53527]
2009-06-01 09:00:02 +00:00
Andrey Semashev 02b34018f4 The std::tm instances are zero initialized before usage in to_tm functions. Related to #1859.
[SVN r53500]
2009-05-31 14:24:25 +00:00
Andrey Semashev 34e2312fa5 Fixed a possible reading overflow in the var_string_to_int function.
Mentioned in ticket #1861.

-This line, and those below, will be ignored--

M    format_date_parser.hpp


[SVN r53485]
2009-05-31 12:03:41 +00:00
Jeremiah Willcock d72c172d31 Fixed almost all tab and min/max issues found by inspect tool
[SVN r53142]
2009-05-20 19:41:20 +00:00
Jeremiah Willcock 49fe4d03ff Fixed most tab and min/max issues from trunk inspection report
[SVN r53141]
2009-05-20 19:19:00 +00:00
John Maddock eff091cd97 Merge PDF build changes from Trunk.
[SVN r51417]
2009-02-23 18:39:32 +00:00
John Maddock 8a5d48f39c Add PDF generation options to fix external links to point to the web site.
Added a few more Boostbook based libs that were missed first time around.
Fixed PDF naming issues.

[SVN r51284]
2009-02-17 10:05:58 +00:00
Andrey Semashev c4531a9c0e Added missing include for the BOOST_NO_STD_WSTRING macro.
[SVN r51229]
2009-02-12 20:33:55 +00:00
Andrey Semashev e0efb39092 Added missing config.hpp include for the wide characters support configuration macro.
[SVN r51030]
2009-02-05 17:48:02 +00:00
Andrey Semashev fbab6c1ddf Merged fixes for #2688 and #2698 from trunk.
[SVN r50942]
2009-02-01 11:29:43 +00:00
Andrey Semashev acc5739dbd Moved last two bug fixes to 1.38 section as they are going to this release.
[SVN r50941]
2009-02-01 11:18:26 +00:00
Andrey Semashev 4812f46d4e Replaced tabs with spaces.
[SVN r50878]
2009-01-29 18:58:24 +00:00
Andrey Semashev 15c4ebd523 Removed dereferencing of end iterators of strings, which could cause crashes on MSVC. Fixed #2698.
[SVN r50877]
2009-01-29 18:54:17 +00:00
Andrey Semashev 5ac35edc3a Added missing #include. Fixed #2688.
[SVN r50876]
2009-01-29 17:44:52 +00:00
Troy D. Straszheim 983db9f225 merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +00:00
Andrey Semashev 86a65b062a testfrmwk.hpp moved to the tests directory. It was not a part of the library public interface and should not be seen by users.
[SVN r49946]
2008-11-26 21:07:14 +00:00
Boris Gubenko bffbf251f0 merge changeset/49940 into release branch
[SVN r49941]
2008-11-26 15:39:19 +00:00
Boris Gubenko 854864f008 work around the bug in aC++ (QXCR1000880488 in the HP bug tracking system)
[SVN r49940]
2008-11-26 15:12:17 +00:00
Andrey Semashev 45512be109 testfrmwk.hpp moved to the tests directory. It was not a part of the library public interface and should not be seen by users.
[SVN r49933]
2008-11-25 20:55:03 +00:00
Andrey Semashev 4a238482e8 testfrmwk.hpp moved to the tests directory. It was not a part of the library public interface and should not be seen by users.
[SVN r49932]
2008-11-25 20:36:52 +00:00
Andrey Semashev ee9241c634 Merged fixes from trunk: tickets 2521, 2523.
[SVN r49893]
2008-11-23 11:13:35 +00:00
Andrey Semashev 462d59604b Fixed a possible crash in gregorian::special_value_from_string if the string did not represent a valid special value. The find_match function now accepts the size of lookup tables rater than the maximum index.
[SVN r49875]
2008-11-22 13:40:54 +00:00
Andrey Semashev 4ea026b835 In FILETIME support functions fixed a possible integer wrapping that would cause to invalid conversion of FILETIME before 1970-01-01 into a DateTime time. In time facet changed the reaction on a too long hours string to an assert rather than truncating the string. Updated docs and tests to reflect these changes.
[SVN r49874]
2008-11-22 12:49:20 +00:00
Andrey Semashev 125082430e Silenced some warnings about unreferenced formal parameters.
[SVN r49729]
2008-11-13 20:10:23 +00:00
Andrey Semashev 415b9adb49 Silenced some warnings about unused formal parameters.
[SVN r49728]
2008-11-13 20:01:18 +00:00
Andrey Semashev b27566e158 Fixed missing <entry> tag.
[SVN r49727]
2008-11-13 19:35:04 +00:00
Andrey Semashev 33fb3ebfe0 Fixed missing <entry> tag.
[SVN r49726]
2008-11-13 19:34:32 +00:00
Andrey Semashev a89cb66083 Fixed examples for time_period constructors.
[SVN r49725]
2008-11-13 19:22:52 +00:00
Andrey Semashev f518db10a5 Fixed examples for time_period constructors.
[SVN r49724]
2008-11-13 19:22:08 +00:00
Andrey Semashev 3af0a51e62 Fixed a number of warnings about shadowed variables. Fixed
date_generator_formatter constructor that accepts custom phrase
elements.


[SVN r49723]
2008-11-13 19:05:31 +00:00
Andrey Semashev e3fcd06a86 Fixed a number of warnings about shadowed variables. Fixed
date_generator_formatter constructor that accepts custom phrase
elements.


[SVN r49722]
2008-11-13 19:04:15 +00:00
Andrey Semashev a2049a59d6 Merged various fixes from trunk.
[SVN r49705]
2008-11-12 19:37:53 +00:00
Andrey Semashev 58f4e4bbd7 Changed the Boost version that will contain the latest changes.
[SVN r49702]
2008-11-12 18:01:37 +00:00
Andrey Semashev 841625c1ac Removed some warnings about unreferenced variables (these were exceptions that were not used).
[SVN r49651]
2008-11-08 18:49:57 +00:00
Andrey Semashev 334b57e8d9 Fixed order of nth_as_str forward declaration and its first usage.
[SVN r49650]
2008-11-08 17:54:38 +00:00
Michael A. Jackson 4bc6196a71 Updating dependency information for modularized libraries.
[SVN r49628]
2008-11-07 17:05:27 +00:00
Michael A. Jackson e68bd489a6 Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
Andrey Semashev ac3a5b489a Fixed incorrect variable naming for systems with no GetSystemTimeAsFileTime function support.
[SVN r49614]
2008-11-06 16:47:56 +00:00
Andrey Semashev ca3bb2dfe8 The test now operates on strings rather than files. This was made in order to reduce possible influence from the file system and improve diagnostics in case of failure.
[SVN r49613]
2008-11-06 16:14:02 +00:00
Andrey Semashev 1dd61b0f86 The test now operates on strings rather than files. This was made in order to reduce possible influence from the file system and improve diagnostics in case of failure.
[SVN r49612]
2008-11-06 16:03:44 +00:00
Andrey Semashev f15712c448 Fixed exception handling that led to inefficient code.
[SVN r49611]
2008-11-06 15:44:10 +00:00
Andrey Semashev b59c3dab04 Fixed exception handling that led to exception type slicing in some cases and simply inefficient code in others.
[SVN r49610]
2008-11-06 15:43:07 +00:00
Andrey Semashev fe220e57b3 Added a missing include that could break compilation of user's code with STLport.
[SVN r49609]
2008-11-06 15:12:17 +00:00
Michael A. Jackson aa74081aff Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
Andrey Semashev d170c71007 Fixed a number of misprints in the documentation, added change notes for
the latest commit. The tests are modified to support the latest changes.


[SVN r49506]
2008-11-01 10:36:57 +00:00
Andrey Semashev 7c851f60d3 Fixed various issues, including missing includes, missing IO operators
for local time, windows.h inclusion on Windows, compilation failure on
GCC 4.3, a number of warnings on GCC and MSVC. Added a new format
specifier %O to format and read more than 99 hours in time durations.
All exception throwing moved to boost::throw_exception in order to
support builds with exceptions disabled.


[SVN r49505]
2008-11-01 10:34:04 +00:00
John Maddock 6c6a6b3a1c Change includes of <cmath> to <boost/config/no_tr1/config.hpp>.
Previously if Boost.TR1 was in the include path then including <cmath> pulls in all the new TR1 math functions, which in turn also requires linking to an external library.  With auto-linking support this requires that library to have been built and be present in the library search path, even if the actual library under use is header only.

Fixes #2392.


[SVN r49254]
2008-10-10 16:10:00 +00:00
Jurko Gospodnetić 19cdab0cd5 Worked around two unused function parameter compiler warnings. Suggested by Peter Klotz.
[SVN r47957]
2008-08-03 10:09:21 +00:00
Jurko Gospodnetić 7c5395ddad Corrected a comment typo in boost/date_time/string_parse_tree.hpp and removed trailing spaces.
[SVN r47641]
2008-07-20 22:02:39 +00:00
Jurko Gospodnetić 2ff01baa21 Comment typo corrections & stylistic changes.
[SVN r47368]
2008-07-13 00:15:30 +00:00
Jurko Gospodnetić e6bb691886 Applied a date_time greg_weekday.hpp typo correction patch by Peter Klotz.
[SVN r46638]
2008-06-24 08:35:07 +00:00
Daniel James aebbc1c144 Merge in documentation fixes. Apart from the change to optional's documenation
Jamfile, which I included by mistake.

Fixes #1659, #1661, #1684, #1685, 1687, #1690, #1801

I wrote about this at:

http://lists.boost.org/Archives/boost/2008/04/136405.php

Merged revisions 44585-44806 via svnmerge from 
https://svn.boost.org/svn/boost/branches/doc

........
  r44585 | danieljames | 2008-04-19 16:25:27 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix broken link to vacpp in bjam docs. Refs #1512
........
  r44586 | danieljames | 2008-04-19 16:27:36 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix broken link to bcpp in bjam docs. Refs #1513
........
  r44587 | danieljames | 2008-04-19 16:33:58 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  DateTime documentation - Fix a link to the serialization library. Refs #1659
........
  r44588 | danieljames | 2008-04-19 16:35:36 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix some links in interprocess & intrusive. Refs #1661
........
  r44589 | danieljames | 2008-04-19 16:37:39 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix some links in the python docs. Refs #1684.
........
  r44590 | danieljames | 2008-04-19 16:38:29 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Work around a quickbook bug which is affecting the python docs. Refs #1684.
........
  r44591 | danieljames | 2008-04-19 16:39:34 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix a broken link in the numeric conversion docs. Refs #1685
........
  r44592 | danieljames | 2008-04-19 16:40:45 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix some links in the optional docs. Refs #1687
........
  r44593 | danieljames | 2008-04-19 16:42:09 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix link to the hash documentation from bimap. Refs #1690
........
  r44599 | danieljames | 2008-04-19 18:07:33 +0100 (Sat, 19 Apr 2008) | 2 lines
  
  Fix a typo in the format library. Refs #1801
........
  r44600 | danieljames | 2008-04-19 19:20:59 +0100 (Sat, 19 Apr 2008) | 1 line
  
  Initialise svnmerge.
........
  r44641 | danieljames | 2008-04-20 18:59:47 +0100 (Sun, 20 Apr 2008) | 2 lines
  
  Fix the lincense url in shared container iterator documentation.
........
  r44642 | danieljames | 2008-04-20 19:00:00 +0100 (Sun, 20 Apr 2008) | 2 lines
  
  Fix image link in the mpi documentation.
........
  r44643 | danieljames | 2008-04-20 19:00:11 +0100 (Sun, 20 Apr 2008) | 2 lines
  
  Fix a typo in the spirit docs.
........
  r44644 | danieljames | 2008-04-20 19:00:23 +0100 (Sun, 20 Apr 2008) | 2 lines
  
  Escape the slash so that quickbook doesn't think it the start of an italic section, and mess up the link. Refs #1844
........
  r44647 | danieljames | 2008-04-20 19:39:47 +0100 (Sun, 20 Apr 2008) | 2 lines
  
  Fix another typo in spirit docs.
........


[SVN r44807]
2008-04-27 07:39:49 +00:00
Emil Dotchevski 48a959accb Reverting previous change... #define NOMINMAX isn't a good idea either.
[SVN r44473]
2008-04-16 18:36:30 +00:00
Emil Dotchevski 6cfc268a27 Added #define NOMINMAX to preserve standard behavior of std::min and std::max. Is including <windows.h> here necessary?
[SVN r44472]
2008-04-16 18:24:17 +00:00
Daniel James 342e17aa5a Fix another license link I seem to have missed.
[SVN r43803]
2008-03-23 13:03:24 +00:00
Daniel James 890e8ed154 Fix license link in date_time.doc
[SVN r43468]
2008-03-03 12:11:25 +00:00
Daniel James 9a267135c1 Tell subversion that date_time.doc is a text file, not a word document.
[SVN r43467]
2008-03-03 12:10:35 +00:00
Daniel James 9b5d99078e Fix broken copyright urls. Fixes #1573.
[SVN r43422]
2008-02-27 18:51:14 +00:00
Daniel James 1629ac31d0 Frank Mori Hess's patch to get the documentation building.
[SVN r41506]
2007-11-30 19:28:46 +00:00
Beman Dawes a9c191bb59 // Add or correct comment identifying Boost library this header is associated with.
[SVN r41173]
2007-11-17 20:13:16 +00:00
David Deakins 957b7ae81c Have the local_time and universal_time functions use GetSystemTime and SystemTimeToFileTime on Windows CE (since GetSystemTimeAsFileTime is not present)
[SVN r41069]
2007-11-13 20:19:39 +00:00
Ralf W. Grosse-Kunstleve c72177cb58 gcc 4.3.0 compatibility (resolves new "changes meaning" error)
[SVN r40558]
2007-10-29 19:12:56 +00:00
Anthony Williams b04e84c09c New mutex implementations, more akin to C++0x
[SVN r39784]
2007-10-08 15:41:05 +00:00
Caleb Epstein 43f9e6bc25 Quiet unused argument warnings from gcc.
[SVN r39274]
2007-09-14 17:18:02 +00:00
Boris Gubenko 7171662c11 on HP-UX, macro BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS should be defined only if macro _REENTRANT is defined
[SVN r39256]
2007-09-14 02:25:06 +00:00
Vladimir Prus 1cbafb20d0 Remove V1 Jamfiles
[SVN r38516]
2007-08-08 19:02:26 +00:00
Jeff Garland 908a40bdc1 apply changes from adobe to remove else clause which makes some compilers spit out a warning.
[SVN r37775]
2007-05-25 19:59:41 +00:00
Jeff Garland ff8d2cf762 timezone updates for mexico sf tracker#1695914
[SVN r37477]
2007-04-21 18:38:39 +00:00
Jeff Garland 387f8b7bf6 fix and clarify ticks_per_second docs.
[SVN r37476]
2007-04-21 18:17:19 +00:00
Rene Rivera 9586e247ac Put in the build support for using the doxproc, Python based, Doxygen to BoostBook translator.
[SVN r37457]
2007-04-17 04:44:59 +00:00
Jeff Garland 2a19fc5fb0 SF tracker 1672139 - fix end time in au_dst_traits to 3 hours instead of 2
[SVN r37130]
2007-03-02 05:19:06 +00:00
Jeff Garland 998143109f Remove unused variables from serialization code to prevent warnings
[SVN r37129]
2007-03-02 02:50:49 +00:00
Jeff Garland 461e80afd6 Changes to fix the compile-time dst rules engines for 2007 US and Canada dst changes
[SVN r37128]
2007-03-02 02:04:55 +00:00
Jeff Garland b232691602 allow tests to pass if the clock time is equal to the last -- happens on fast machines.
[SVN r37066]
2007-02-25 20:00:37 +00:00
Jeff Garland f504c68f58 fix problem with acc by including sstream
[SVN r37047]
2007-02-23 15:30:31 +00:00
Jeff Garland 3dba864d34 updates to docs for new timezone checkins
[SVN r37043]
2007-02-23 02:21:58 +00:00
Jeff Garland 5becc5c309 test update to coorespond to new 2007 DST rules in US and new tz database.csv file
[SVN r37011]
2007-02-20 03:01:31 +00:00
Jeff Garland 0ed19eeb72 Update of DST rules for US 2007 -- plus a few misc changes for other locations
[SVN r37010]
2007-02-20 03:00:32 +00:00
Jeff Garland 53042733a8 minor documentation fix for end_of_month method
[SVN r37004]
2007-02-19 13:30:42 +00:00
Jeff Garland bf9502ac86 add single overall include file for date time lib
[SVN r35756]
2006-10-27 23:21:38 +00:00
Daniel James 325834a1d7 Merge in recent fixes for inspect errors.
[SVN r34973]
2006-08-27 10:40:36 +00:00
Jeff Garland 4288e5fc08 minor wording update
[SVN r34868]
2006-08-11 13:53:46 +00:00
Jeff Garland ed1cb467d0 fixes for copyright
[SVN r34640]
2006-07-20 15:55:16 +00:00
Jeff Garland 53030e4527 minor change to fix issue that prevents sun 5.8 from linking correctly
[SVN r34454]
2006-07-03 15:25:19 +00:00
Jeff Garland 627693d12d Update changes / bugfixes and complier notes for 1.34 release
[SVN r34392]
2006-06-25 17:04:35 +00:00
Jeff Garland 17b02e954c fix an issue with multiple defines under some circumstances -- change static const into an enum
[SVN r34382]
2006-06-23 18:05:48 +00:00
Jeff Garland 0dadfe419a add some test diagnostics to get more information about regression failures
[SVN r34283]
2006-06-12 14:46:54 +00:00
Jeff Garland 963cb4d5c8 couple minor documentation updates before 1.34 release
[SVN r34071]
2006-05-23 15:05:05 +00:00
Jeff Garland 2f8e311836 Fix header guard mismatch issue -- basically cleanup as the guard mismatch doesn't have an effect in this case.
[SVN r34067]
2006-05-23 14:38:15 +00:00
Jeff Garland abee080986 updates to time_period to add section for mutors -- correctly document shift functions
[SVN r33973]
2006-05-15 15:18:55 +00:00
Eric Niebler e9752ce604 doxygen references automatically generated now. deleting stale ones
[SVN r33617]
2006-04-10 03:27:13 +00:00
Jeff Garland 2d22341ee6 apply Eric Nieblers patch to fix doxygen processing
[SVN r33615]
2006-04-09 20:31:57 +00:00
Jeff Garland 269f799e99 Apply modified version of gcc warning patch from Stephan L. to main branch
[SVN r33481]
2006-03-26 21:35:58 +00:00
Jeff Garland bd25005368 add documentation for the expand function on date and time periods.
[SVN r33479]
2006-03-26 20:45:06 +00:00
Jeff Garland 2af5cd1361 add an expand function to the period
[SVN r33478]
2006-03-26 20:12:41 +00:00
Rene Rivera 6d728ddd40 Add missing requirement rule when using the shared version of serialization.
[SVN r33456]
2006-03-23 15:16:22 +00:00
207 changed files with 7780 additions and 5194 deletions
+116
View File
@@ -0,0 +1,116 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2017 - 2019 James E. King III
# Copyright 2019 - 2021 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# Generic Appveyor build script for boostorg repositories
# See: https://github.com/boostorg/boost-ci/
#
# Instructions for customizing this script for your library:
#
# 1. Customize the compilers and language levels you want.
# 2. If you have more than include/, src/, test/, example/, examples/,
# benchmark/ or tools/ directories, set the environment variable DEPINST.
# For example if your build uses code in "bench/" and "fog/" directories:
# - DEPINST: --include bench --include fog
# 3. Enable pull request builds in your boostorg/<library> account.
#
# That's it - the script will do everything else for you.
#
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
- /bugfix\/.*/
- /feature\/.*/
- /fix\/.*/
- /pr\/.*/
matrix:
fast_finish: false
# Adding MAYFAIL to any matrix job allows it to fail but the build stays green:
allow_failures:
- MAYFAIL: true
environment:
global:
B2_CI_VERSION: 1
GIT_FETCH_JOBS: 4
# see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties
# to use the default for a given environment, comment it out; recommend you build debug and release however:
# on Windows it is important to exercise all the possibilities, especially shared vs static, however most
# libraries that care about this exercise it in their Jamfiles...
B2_ADDRESS_MODEL: 32,64
B2_LINK: shared,static
# B2_THREADING: threading=multi,single
B2_VARIANT: release
BOOST_DATE_TIME_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS: 1
matrix:
- FLAVOR: Visual Studio 2017 C++2a Strict
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_CXXFLAGS: -permissive-
B2_CXXSTD: 2a
B2_TOOLSET: msvc-14.1
- FLAVOR: Visual Studio 2017 C++14/17
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_CXXSTD: 14,17
B2_TOOLSET: msvc-14.1
- FLAVOR: clang-cl
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 11,14,17
B2_TOOLSET: clang-win
- FLAVOR: Visual Studio 2015, 2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
B2_TOOLSET: msvc-12.0,msvc-14.0
- FLAVOR: Visual Studio 2008, 2010, 2012
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
B2_TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
B2_ADDRESS_MODEL: 32 # No 64bit support
- FLAVOR: cygwin (32-bit)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin\bin;
B2_ADDRESS_MODEL: 32
B2_CXXSTD: 03,11,14,1z
B2_THREADING: threadapi=pthread
B2_TOOLSET: gcc
- FLAVOR: cygwin (64-bit)
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin64\bin;
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 03,11,14,1z
B2_THREADING: threadapi=pthread
B2_TOOLSET: gcc
- FLAVOR: mingw64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;
B2_ADDRESS_MODEL: 64
B2_CXXSTD: 03,11,14,17,2a
B2_TOOLSET: gcc
install:
- git clone --depth 1 https://github.com/boostorg/boost-ci.git C:\boost-ci-cloned
# Copy ci folder if not testing Boost.CI
- if NOT "%APPVEYOR_PROJECT_NAME%" == "boost-ci" xcopy /s /e /q /i /y C:\boost-ci-cloned\ci .\ci
- rmdir /s /q C:\boost-ci-cloned
- ci\appveyor\install.bat
build: off
test_script: ci\build.bat
+23
View File
@@ -0,0 +1,23 @@
# Copyright 2019 - 2021 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# Sample codecov configuration file. Edit as required
codecov:
max_report_age: off
require_ci_to_pass: yes
notify:
# Increase this if you have multiple coverage collection jobs
after_n_builds: 2
wait_for_ci: yes
# Change how pull request comments look
comment:
layout: "reach,diff,flags,files,footer"
# Ignore specific files or folders. Glob patterns are supported.
# See https://docs.codecov.com/docs/ignoring-paths
ignore:
- libs/date_time/test/
- test
+50
View File
@@ -0,0 +1,50 @@
#
# Copyright 2020-2021 Peter Dimov
# Copyright 2021 Andrey Semashev
# Copyright 2021-2024 Alexander Grund
# Copyright 2022-2025 James E. King III
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# This workflow uses the Boost.CI reusable workflow which builds a variety of
# configurations of your project, runs tests, and generates code coverage reports.
#
# To use it, copy this file into your repository as `.github/workflows/ci.yml` and
# customize it appropriately.
#
---
name: Boost.CI
on:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
- README.md
jobs:
call-boost-ci:
name: Run Boost.CI
uses: boostorg/boost-ci/.github/workflows/reusable.yml@master
with:
# no endian branches
enable_multiarch: false
# serialization has issues, not enough time to add suppressions
enable_sanitizers: false
# these compilers fail
exclude_compiler: 'gcc-4.7,gcc-4.8,gcc-4.9,gcc-5,clang-3.5,clang-3.6,clang-3.7,clang-3.8'
# the tests take a while; this reduces the load a bit and there isn't any C++20 specific code
exclude_cxxstd: '98,03,0x,2a,20'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
+2
View File
@@ -0,0 +1,2 @@
**/test_facet_file.out
**/time_duration_serialization.*
+4
View File
@@ -0,0 +1,4 @@
# https://github.com/boostorg/serialization/issues/122
vptr:/usr/include/c++/*/bits/ios_base.h
# https://github.com/boostorg/serialization/issues/193
# could not figure out how to suppress it
+53
View File
@@ -0,0 +1,53 @@
# Generated by `boostdep --cmake date_time`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_date_time VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_date_time
src/gregorian/greg_month.cpp
)
add_library(Boost::date_time ALIAS boost_date_time)
target_include_directories(boost_date_time PUBLIC include)
target_link_libraries(boost_date_time
PUBLIC
Boost::algorithm
Boost::assert
Boost::config
Boost::core
Boost::io
Boost::lexical_cast
Boost::numeric_conversion
Boost::range
Boost::smart_ptr
Boost::static_assert
Boost::throw_exception
Boost::tokenizer
Boost::type_traits
Boost::utility
Boost::winapi
)
target_compile_definitions(boost_date_time
PUBLIC BOOST_DATE_TIME_NO_LIB
PRIVATE BOOST_DATE_TIME_SOURCE
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(boost_date_time PUBLIC BOOST_DATE_TIME_DYN_LINK)
else()
target_compile_definitions(boost_date_time PUBLIC BOOST_DATE_TIME_STATIC_LINK)
endif()
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()
+23
View File
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
+40
View File
@@ -0,0 +1,40 @@
DateTime, part of the collection of [Boost C++ Libraries](http://github.com/boostorg), makes programming with dates and times as simple and natural as programming with strings and integers.
### License
Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
### Properties
* C++11
* Header only
### Build Status
<!-- boost-ci/tools/makebadges.sh --repo date_time --appveyorbadge upf5c528fy09fudk --codecovbadge nDoh7t8f6g --coverity 14908 -->
| Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests |
| :-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- |
| [`master`](https://github.com/boostorg/date_time/tree/master) | [![Build Status](https://github.com/boostorg/date_time/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/date_time/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk/branch/master?svg=true)](https://ci.appveyor.com/project/cppalliance/date-time/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14908/badge.svg)](https://scan.coverity.com/projects/boostorg-date_time) | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/master/graph/badge.svg?token=nDoh7t8f6g)](https://codecov.io/gh/boostorg/date_time/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/date_time.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/date_time) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://www.boost.org/development/tests/master/developer/date_time.html) |
| [`develop`](https://github.com/boostorg/date_time/tree/develop) | [![Build Status](https://github.com/boostorg/date_time/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/date_time/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/upf5c528fy09fudk/branch/develop?svg=true)](https://ci.appveyor.com/project/cppalliance/date-time/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14908/badge.svg)](https://scan.coverity.com/projects/boostorg-date_time) | [![codecov](https://codecov.io/gh/boostorg/date_time/branch/develop/graph/badge.svg?token=nDoh7t8f6g)](https://codecov.io/gh/boostorg/date_time/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/date_time.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/date_time) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://www.boost.org/development/tests/develop/developer/date_time.html) |
### Directories
Note that the built library is only for build backward compatibility and contains no symbols. date_time is now header only.
| Name | Purpose |
| --------- | --------------------------------------- |
| `build` | build script for optional lib build |
| `data` | timezone database |
| `doc` | documentation |
| `example` | use case examples |
| `include` | headers |
| `src` | source code for optional link library |
| `test` | unit tests |
| `xmldoc` | documentation source |
### More information
* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-date_time): Be sure to read the documentation first to see if it answers your question.
* [Report bugs](https://github.com/boostorg/date_time/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* [Submit Pull Requests](https://github.com/boostorg/date_time/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly.
* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[date_time]` tag at the beginning of the subject line.
+38
View File
@@ -0,0 +1,38 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/algorithm//boost_algorithm
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/io//boost_io
/boost/lexical_cast//boost_lexical_cast
/boost/numeric_conversion//boost_numeric_conversion
/boost/range//boost_range
/boost/smart_ptr//boost_smart_ptr
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/tokenizer//boost_tokenizer
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility
/boost/winapi//boost_winapi ;
project /boost/date_time
: common-requirements
<include>include
;
explicit
[ alias boost_date_time : build//boost_date_time ]
[ alias all : boost_date_time example test ]
;
call-if : boost-library date_time
: install boost_date_time
;
+10 -20
View File
@@ -1,34 +1,24 @@
# Copyright (c) 2002-2005 CrystalClear Software, Inc.
# Use, modification and distribution is subject to the
# Use, modification and distribution is subject to the
# Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
#
# Boost.date_time build and test Jamfile
#
# Based on boost.python Jamfile
#
# To run all tests quietly: jam test
#
# Declares the following targets:
# 1. libboost_date_time, a static link library to be linked with all
# Boost.date_time modules
# date_time is now header only -- this file provides a stub for backward compatibility
#
project boost/date_time
project
: common-requirements <library>$(boost_dependencies)
: requirements
<define>DATE_TIME_INLINE
<link>shared:<define>BOOST_ALL_DYN_LINK=1
<link>static:<define>BOOST_DATE_TIME_STATIC_LINK
: usage-requirements
<link>shared:<define>BOOST_ALL_DYN_LINK=1
: usage-requirements
<define>DATE_TIME_INLINE
<link>shared:<define>BOOST_DATE_TIME_DYN_LINK=1
<define>BOOST_DATE_TIME_NO_LINK=1
: source-location ../src
;
# Base names of the source files for libboost_date_time
CPP_SOURCES = greg_month greg_weekday date_generators ;
lib boost_date_time : gregorian/$(CPP_SOURCES).cpp ;
boost-install boost_date_time ;
# greg_month.cpp is now just a stub so that there is
# still a boost_date_time library to link for backward compatibility
lib boost_date_time : gregorian/greg_month.cpp ;
+20
View File
@@ -1,3 +1,23 @@
# Generating
https://github.com/fmidev/smartmet-timezones/tree/master/bin provided
a method to generate the content, which uses an unlicence, so it was
copied into this repository for posterity and future use.
./create_date_time_zoneinfo.sh > date_time_zonespec.csv
# Compatibility
The current version is IANA 2025b.
Previous versions of the data file (IANA 2016c) had short and long special
names but only for America/Chicago, America/Denver, America/Los_Angeles,
America/New_York, America/Phoenix, but time zones like America/Detroit,
America/Fort_Wayne, America/Indiana/Petersburg, etc... did not; when
regenerating for IANA 2025b the short and long names became identical
for those previously mentions time zones.
# File Format
The csv file containing the zone_specs used by the
boost::local_time::tz_database is intended to be customized by the
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# Header field
echo '"ID","STD ABBR","STD NAME","DST ABBR","DST NAME","GMT offset","DST adjustment","DST Start Date rule","Start time","DST End date rule","End time"'
# We ignore POSIX and leap-second files, Boost does not use them.
for tz in $(find /usr/share/zoneinfo \
-path /usr/share/zoneinfo/right -prune -o \
-path /usr/share/zoneinfo/posix -prune -o \
-type f \
| grep -v "\.tab" \
| grep -v posix \
| grep -v right \
| grep -v leapseconds \
| grep -v tzdata \
| sed -e 's|/usr/share/zoneinfo/||g' \
| sort);
do
perl tzinfo.pl $tz;
done
+298 -232
View File
@@ -3,7 +3,7 @@
"Africa/Accra","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Addis_Ababa","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Algiers","CET","CET","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Asmera","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Asmara","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bamako","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bangui","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Banjul","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
@@ -11,21 +11,22 @@
"Africa/Blantyre","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Brazzaville","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Bujumbura","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Cairo","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;5;4","+00:00:00","-1;5;9","+00:00:00"
"Africa/Casablanca","WET","WET","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Cairo","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;5;4","+00:00:00","-1;4;10","+00:00:00"
"Africa/Casablanca","+01","+01","+00","+00","+01:00:00","-01:00:00","-1;0;2","+02:00:00","1;0;4","+03:00:00"
"Africa/Ceuta","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Africa/Conakry","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Dakar","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Dar_es_Salaam","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Djibouti","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Douala","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/El_Aaiun","WET","WET","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/El_Aaiun","+01","+01","+00","+00","+01:00:00","-01:00:00","-1;0;2","+02:00:00","1;0;4","+03:00:00"
"Africa/Freetown","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Gaborone","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Harare","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Johannesburg","SAST","SAST","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Juba","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Kampala","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Khartoum","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Africa/Khartoum","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Kigali","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Kinshasa","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Lagos","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
@@ -47,336 +48,401 @@
"Africa/Ouagadougou","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Porto-Novo","WAT","WAT","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Sao_Tome","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Timbuktu","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Africa/Tripoli","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Africa/Tunis","CET","CET","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Africa/Windhoek","WAT","WAT","WAST","WAST","+01:00:00","+01:00:00","1;0;9","+02:00:00","1;0;4","+02:00:00"
"America/Adak","HAST","HAST","HADT","HADT","-10:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Africa/Windhoek","CAT","CAT","","","+02:00:00","+00:00:00","","","","+00:00:00"
"America/Adak","HST","HST","HDT","HDT","-10:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Anchorage","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Anguilla","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Antigua","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Araguaina","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Araguaina","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Buenos_Aires","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Catamarca","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Cordoba","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Jujuy","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/La_Rioja","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Mendoza","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Rio_Gallegos","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Salta","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/San_Juan","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/San_Luis","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Tucuman","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Argentina/Ushuaia","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Aruba","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Asuncion","PYT","PYT","PYST","PYST","-04:00:00","+01:00:00","1;0;10","+00:00:00","1;0;3","+00:00:00"
"America/Asuncion","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Atikokan","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Bahia","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Bahia_Banderas","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Barbados","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Belem","BRT","BRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Belem","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Belize","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Boa_Vista","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Bogota","COT","COT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Blanc-Sablon","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Boa_Vista","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Bogota","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Boise","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Buenos_Aires","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cambridge_Bay","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Cancun","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Caracas","VET","VET","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Catamarca","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cayenne","GFT","GFT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Campo_Grande","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Cancun","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Caracas","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Cayenne","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Cayman","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Chicago","CST","Central Standard Time","CDT","Central Daylight Time","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Chihuahua","MST","MST","MDT","MDT","-07:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Cordoba","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Chicago","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Chihuahua","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Ciudad_Juarez","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Costa_Rica","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Cuiaba","AMT","AMT","AMST","AMST","-04:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Coyhaique","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Creston","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Cuiaba","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Curacao","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Danmarkshavn","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"America/Dawson","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Dawson","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Dawson_Creek","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Denver","MST","Mountain Standard Time","MDT","Mountain Daylight Time","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Denver","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Detroit","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Dominica","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Edmonton","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Eirunepe","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Eirunepe","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/El_Salvador","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Fortaleza","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Fortaleza","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Fort_Nelson","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Glace_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Godthab","WGT","WGT","WGST","WGST","-03:00:00","+01:00:00","-1;6;3","+22:00:00","-1;6;10","+23:00:00"
"America/Goose_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","1;0;4","+00:01:00","-1;0;10","+00:01:00"
"America/Grand_Turk","EST","EST","EDT","EDT","-05:00:00","+01:00:00","1;0;4","+00:00:00","-1;0;10","+00:00:00"
"America/Goose_Bay","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Grand_Turk","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Grenada","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Guadeloupe","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Guatemala","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Guayaquil","ECT","ECT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Guyana","GYT","GYT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Guayaquil","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Guyana","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Halifax","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Havana","CST","CST","CDT","CDT","-05:00:00","+01:00:00","1;0;4","+00:00:00","-1;0;10","+01:00:00"
"America/Havana","CST","CST","CDT","CDT","-05:00:00","+01:00:00","2;0;3","+00:00:00","1;0;11","+01:00:00"
"America/Hermosillo","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Indiana/Indianapolis","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Knox","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Marengo","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Vevay","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indianapolis","EST","EST","","","-05:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Indiana/Indianapolis","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Knox","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Marengo","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Petersburg","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Tell_City","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Vevay","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Vincennes","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Indiana/Winamac","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Inuvik","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Iqaluit","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Jamaica","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Jujuy","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Juneau","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Kentucky/Louisville","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Kentucky/Monticello","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/La_Paz","BOT","BOT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Lima","PET","PET","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Los_Angeles","PST","Pacific Standard Time","PDT","Pacific Daylight Time","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Louisville","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Maceio","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/La_Paz","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Lima","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Los_Angeles","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Maceio","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Managua","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Manaus","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Manaus","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Martinique","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Mazatlan","MST","MST","MDT","MDT","-07:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Mendoza","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Matamoros","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Mazatlan","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Menominee","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Merida","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Mexico_City","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Miquelon","PMST","PMST","PMDT","PMDT","-03:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Monterrey","CST","CST","CDT","CDT","-06:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Montevideo","UYT","UYT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Montreal","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Merida","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Metlakatla","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Mexico_City","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Miquelon","-03","-03","-02","-02","-03:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Moncton","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Monterrey","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Montevideo","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Montserrat","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Nassau","EST","EST","EDT","EDT","-05:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/New_York","EST","Eastern Standard Time","EDT","Eastern Daylight Time","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nipigon","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nassau","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/New_York","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nome","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Noronha","FNT","FNT","","","-02:00:00","+00:00:00","","","","+00:00:00"
"America/Noronha","-02","-02","","","-02:00:00","+00:00:00","","","","+00:00:00"
"America/North_Dakota/Beulah","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/North_Dakota/Center","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/North_Dakota/New_Salem","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Nuuk","-02","-02","-01","-01","-02:00:00","+01:00:00","-1;0;3","+23:00:00","-1;0;10","+00:00:00"
"America/Ojinaga","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Panama","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Pangnirtung","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Paramaribo","SRT","SRT","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Phoenix","MST","Mountain Standard Time","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Port-au-Prince","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Paramaribo","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Phoenix","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Port-au-Prince","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Port_of_Spain","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Porto_Velho","AMT","AMT","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Porto_Velho","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Puerto_Rico","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Rainy_River","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Punta_Arenas","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Rankin_Inlet","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Recife","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Recife","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Regina","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Rio_Branco","ACT","ACT","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Rosario","ART","ART","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Santiago","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;10","+00:00:00","2;0;3","+00:00:00"
"America/Resolute","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Rio_Branco","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"America/Santarem","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Santiago","-04","-04","-03","-03","-04:00:00","+01:00:00","1;0;9","+23:00:00","1;0;4","+01:00:00"
"America/Santo_Domingo","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Sao_Paulo","BRT","BRT","BRST","BRST","-03:00:00","+01:00:00","2;0;10","+00:00:00","3;0;2","+00:00:00"
"America/Scoresbysund","EGT","EGT","EGST","EGST","-01:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+01:00:00"
"America/Shiprock","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/St_Johns","NST","NST","NDT","NDT","-03:30:00","+01:00:00","1;0;4","+00:01:00","-1;0;10","+00:01:00"
"America/Sao_Paulo","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"America/Scoresbysund","-02","-02","-01","-01","-02:00:00","+01:00:00","-1;0;3","+23:00:00","-1;0;10","+00:00:00"
"America/Sitka","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/St_Johns","NST","NST","NDT","NDT","-03:30:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/St_Kitts","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Lucia","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Thomas","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/St_Vincent","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Swift_Current","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Tegucigalpa","CST","CST","","","-06:00:00","+00:00:00","","","","+00:00:00"
"America/Thule","AST","AST","","","-04:00:00","+00:00:00","2;0;3","","1;0;11","+00:00:00"
"America/Thunder_Bay","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Tijuana","PST","PST","PDT","PDT","-08:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"America/Thule","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Tijuana","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Toronto","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Tortola","AST","AST","","","-04:00:00","+00:00:00","","","","+00:00:00"
"America/Vancouver","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Whitehorse","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Winnipeg","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+03:00:00"
"America/Whitehorse","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"America/Winnipeg","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Yakutat","AKST","AKST","AKDT","AKDT","-09:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"America/Yellowknife","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Antarctica/Casey","WST","WST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Davis","DAVT","DAVT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/DumontDUrville","DDUT","DDUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Mawson","MAWT","MAWT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/McMurdo","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Antarctica/Palmer","CLT","CLT","CLST","CLST","-04:00:00","+01:00:00","2;0;10","+00:00:00","2;0;3","+00:00:00"
"Antarctica/South_Pole","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Antarctica/Syowa","SYOT","SYOT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Vostok","VOST","VOST","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Arctic/Longyearbyen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Aden","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Almaty","ALMT","ALMT","ALMST","ALMST","+06:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Amman","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;4;3","+00:00:00","-1;4;9","+01:00:00"
"Asia/Anadyr","ANAT","ANAT","ANAST","ANAST","+12:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Aqtau","AQTT","AQTT","AQTST","AQTST","+04:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Aqtobe","AQTT","AQTT","AQTST","AQTST","+05:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Ashgabat","TMT","TMT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baghdad","AST","AST","ADT","ADT","+03:00:00","+01:00:00","1;0;4","+03:00:00","1;0;10","+04:00:00"
"Asia/Bahrain","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baku","AZT","AZT","AZST","AZST","+04:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+01:00:00"
"Asia/Bangkok","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Beirut","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Bishkek","KGT","KGT","KGST","KGST","+05:00:00","+01:00:00","-1;0;3","+02:30:00","-1;0;10","+02:30:00"
"Asia/Brunei","BNT","BNT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Calcutta","IST","IST","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Choibalsan","CHOT","CHOT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Chongqing","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Colombo","LKT","LKT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Damascus","EET","EET","EEST","EEST","+02:00:00","+01:00:00","1;0;4","+00:00:00","1;0;10","+00:00:00"
"Asia/Dhaka","BDT","BDT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dili","TPT","TPT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dubai","GST","GST","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dushanbe","TJT","TJT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Gaza","EET","EET","EEST","EEST","+02:00:00","+01:00:00","3;5;4","+00:00:00","3;5;10","+00:00:00"
"Asia/Harbin","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Casey","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Davis","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/DumontDUrville","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Macquarie","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Antarctica/Mawson","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/McMurdo","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Antarctica/Palmer","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Rothera","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Syowa","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Antarctica/Troll","+00","+00","+02","+02","+00:00:00","+02:00:00","-1;0;3","+01:00:00","-1;0;10","+03:00:00"
"Antarctica/Vostok","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Aden","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Almaty","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Amman","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Anadyr","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Asia/Aqtau","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Aqtobe","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ashgabat","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Atyrau","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baghdad","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Bahrain","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Baku","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Bangkok","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Barnaul","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Beirut","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+00:00:00","-1;6;10","+00:00:00"
"Asia/Bishkek","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Brunei","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Chita","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Colombo","+0530","+0530","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Damascus","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dhaka","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dili","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dubai","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Dushanbe","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Famagusta","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Asia/Gaza","EET","EET","EEST","EEST","+02:00:00","+01:00:00","2;6;4","+02:00:00","-1;6;10","+02:00:00"
"Asia/Hebron","EET","EET","EEST","EEST","+02:00:00","+01:00:00","2;6;4","+02:00:00","-1;6;10","+02:00:00"
"Asia/Ho_Chi_Minh","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Hong_Kong","HKT","HKT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Hovd","HOVT","HOVT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Irkutsk","IRKT","IRKT","IRKST","IRKST","+08:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Istanbul","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Asia/Jakarta","WIT","WIT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jayapura","EIT","EIT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jerusalem","IST","IST","IDT","IDT","+02:00:00","+01:00:00","1;0;4","+01:00:00","1;0;10","+01:00:00"
"Asia/Kabul","AFT","AFT","","","+04:30:00","+00:00:00","","","","+00:00:00"
"Asia/Kamchatka","PETT","PETT","PETST","PETST","+12:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Hovd","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Irkutsk","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jakarta","WIB","WIB","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jayapura","WIT","WIT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Jerusalem","IST","IST","IDT","IDT","+02:00:00","+01:00:00","-1;5;3","+02:00:00","-1;0;10","+02:00:00"
"Asia/Kabul","+0430","+0430","","","+04:30:00","+00:00:00","","","","+00:00:00"
"Asia/Kamchatka","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Asia/Karachi","PKT","PKT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kashgar","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Katmandu","NPT","NPT","","","+05:45:00","+00:00:00","","","","+00:00:00"
"Asia/Krasnoyarsk","KRAT","KRAT","KRAST","KRAST","+07:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Kuala_Lumpur","MYT","MYT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuching","MYT","MYT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuwait","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Macao","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kathmandu","+0545","+0545","","","+05:45:00","+00:00:00","","","","+00:00:00"
"Asia/Khandyga","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kolkata","IST","IST","","","+05:30:00","+00:00:00","","","","+00:00:00"
"Asia/Krasnoyarsk","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuala_Lumpur","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuching","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Kuwait","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Macau","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Magadan","MAGT","MAGT","MAGST","MAGST","+11:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Makassar","CIT","CIT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Manila","PHT","PHT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Muscat","GST","GST","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Magadan","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Asia/Makassar","WITA","WITA","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Manila","PST","PST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Muscat","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Nicosia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Asia/Novosibirsk","NOVT","NOVT","NOVST","NOVST","+06:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Omsk","OMST","OMST","OMSST","OMSST","+06:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Oral","WST","WST","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Phnom_Penh","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pontianak","WIT","WIT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Novokuznetsk","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Novosibirsk","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Omsk","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Oral","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Phnom_Penh","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pontianak","WIB","WIB","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Pyongyang","KST","KST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qyzylorda","KST","KST","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qatar","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Rangoon","MMT","MMT","","","+06:30:00","+00:00:00","","","","+00:00:00"
"Asia/Riyadh","AST","AST","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Saigon","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Sakhalin","SAKT","SAKT","SAKST","SAKST","+10:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Samarkand","UZT","UZT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qatar","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qostanay","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Qyzylorda","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Riyadh","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Asia/Sakhalin","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Asia/Samarkand","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Seoul","KST","KST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Shanghai","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Singapore","SGT","SGT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Singapore","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Srednekolymsk","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Asia/Taipei","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tashkent","UZT","UZT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tbilisi","GET","GET","GEST","GEST","+04:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+00:00:00"
"Asia/Tehran","IRT","IRT","","","+03:30:00","+00:00:00","","","","+00:00:00"
"Asia/Thimphu","BTT","BTT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tashkent","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tbilisi","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tehran","+0330","+0330","","","+03:30:00","+00:00:00","","","","+00:00:00"
"Asia/Thimphu","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Tokyo","JST","JST","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ujung_Pandang","CIT","CIT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ulaanbaatar","ULAT","ULAT","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Urumqi","CST","CST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vientiane","ICT","ICT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vladivostok","VLAT","VLAT","VLAST","VLAST","+10:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yakutsk","YAKT","YAKT","YAKST","YAKST","+09:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yekaterinburg","YEKT","YEKT","YEKST","YEKST","+05:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Asia/Yerevan","AMT","AMT","AMST","AMST","+04:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Atlantic/Azores","AZOT","AZOT","AZOST","AZOST","-01:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+01:00:00"
"Atlantic/Bermuda","AST","AST","ADT","ADT","-04:00:00","+01:00:00","1;0;4","+02:00:00","-1;0;10","+02:00:00"
"Asia/Tomsk","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ulaanbaatar","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Asia/Urumqi","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Asia/Ust-Nera","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vientiane","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Asia/Vladivostok","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yakutsk","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yangon","+0630","+0630","","","+06:30:00","+00:00:00","","","","+00:00:00"
"Asia/Yekaterinburg","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Asia/Yerevan","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Azores","-01","-01","+00","+00","-01:00:00","+01:00:00","-1;0;3","+00:00:00","-1;0;10","+01:00:00"
"Atlantic/Bermuda","AST","AST","ADT","ADT","-04:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Atlantic/Canary","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Cape_Verde","CVT","CVT","","","-01:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Faeroe","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Jan_Mayen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Atlantic/Cape_Verde","-01","-01","","","-01:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Faroe","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Madeira","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Atlantic/Reykjavik","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/South_Georgia","GST","GST","","","-02:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/South_Georgia","-02","-02","","","-02:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Stanley","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/St_Helena","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Atlantic/Stanley","FKT","FKT","FKST","FKST","-04:00:00","+01:00:00","1;0;9","+02:00:00","3;0;4","+02:00:00"
"Australia/Adelaide","CST","CST","CST","CST","+09:30:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Brisbane","EST","EST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Broken_Hill","CST","CST","CST","CST","+09:30:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Darwin","CST","CST","","","+09:30:00","+00:00:00","","","","+00:00:00"
"Australia/Hobart","EST","EST","EST","EST","+10:00:00","+01:00:00","1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Lindeman","EST","EST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Lord_Howe","LHST","LHST","LHST","LHST","+10:30:00","+00:30:00","-1;0;10","+02:00:00","-1;0;3","+02:00:00"
"Australia/Melbourne","EST","EST","EST","EST","+10:00:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Perth","WST","WST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Australia/Sydney","EST","EST","EST","EST","+10:00:00","+01:00:00","-1;0;10","+02:00:00","-1;0;3","+03:00:00"
"Australia/Adelaide","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Brisbane","AEST","AEST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Broken_Hill","ACST","ACST","ACDT","ACDT","+09:30:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Darwin","ACST","ACST","","","+09:30:00","+00:00:00","","","","+00:00:00"
"Australia/Eucla","+0845","+0845","","","+08:45:00","+00:00:00","","","","+00:00:00"
"Australia/Hobart","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Lindeman","AEST","AEST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Australia/Lord_Howe","+1030","+1030","+11","+11","+10:30:00","+00:30:00","1;0;10","+02:00:00","1;0;4","+02:00:00"
"Australia/Melbourne","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Australia/Perth","AWST","AWST","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Australia/Sydney","AEST","AEST","AEDT","AEDT","+10:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"CET","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"CST6CDT","CST","CST","CDT","CDT","-06:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"EET","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"EST","EST","EST","","","-05:00:00","+00:00:00","","","","+00:00:00"
"EST5EDT","EST","EST","EDT","EDT","-05:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Etc/GMT","GMT","GMT","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+1","-01","-01","","","-01:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-1","+01","+01","","","+01:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+10","-10","-10","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-10","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+11","-11","-11","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-11","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+12","-12","-12","","","-12:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-12","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-13","+13","+13","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-14","+14","+14","","","+14:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+2","-02","-02","","","-02:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-2","+02","+02","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+3","-03","-03","","","-03:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-3","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+4","-04","-04","","","-04:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-4","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+5","-05","-05","","","-05:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-5","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+6","-06","-06","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-6","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+7","-07","-07","","","-07:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-7","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+8","-08","-08","","","-08:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-8","+08","+08","","","+08:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT+9","-09","-09","","","-09:00:00","+00:00:00","","","","+00:00:00"
"Etc/GMT-9","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Etc/UTC","UTC","UTC","","","+00:00:00","+00:00:00","","","","+00:00:00"
"Europe/Amsterdam","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Andorra","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Astrakhan","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Europe/Athens","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Belfast","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Belgrade","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Berlin","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Bratislava","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Brussels","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Bucharest","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Budapest","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Chisinau","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Chisinau","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+02:00:00"
"Europe/Copenhagen","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Dublin","GMT","GMT","IST","IST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Dublin","IST","IST","GMT","GMT","+01:00:00","-01:00:00","-1;0;10","+02:00:00","-1;0;3","+01:00:00"
"Europe/Gibraltar","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Guernsey","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Helsinki","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Istanbul","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Kaliningrad","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Kiev","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Isle_of_Man","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Istanbul","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Jersey","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Kaliningrad","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Kirov","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Kyiv","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Lisbon","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Ljubljana","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/London","GMT","GMT","BST","BST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
"Europe/Luxembourg","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Madrid","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Malta","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Minsk","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Minsk","+03","+03","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Monaco","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Moscow","MSK","MSK","MSD","MSD","+03:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Nicosia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Moscow","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Oslo","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Paris","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Prague","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Riga","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Rome","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Samara","SAMT","SAMT","SAMST","SAMST","+04:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/San_Marino","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Samara","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Europe/Sarajevo","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Simferopol","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Saratov","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Europe/Simferopol","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Skopje","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Sofia","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Stockholm","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Tallinn","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Tallinn","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Tirane","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Uzhgorod","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Ulyanovsk","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Europe/Vaduz","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vatican","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vienna","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Vilnius","EET","EET","","","+02:00:00","+00:00:00","","","","+00:00:00"
"Europe/Vilnius","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Volgograd","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Europe/Warsaw","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Zagreb","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Europe/Zaporozhye","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
"Europe/Zurich","CET","CET","CEST","CEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"Factory","-00","-00","","","+00:00:00","+00:00:00","","","","+00:00:00"
"HST","HST","HST","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Indian/Antananarivo","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Indian/Chagos","IOT","IOT","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Indian/Christmas","CXT","CXT","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Indian/Cocos","CCT","CCT","","","+06:30:00","+00:00:00","","","","+00:00:00"
"Indian/Chagos","+06","+06","","","+06:00:00","+00:00:00","","","","+00:00:00"
"Indian/Christmas","+07","+07","","","+07:00:00","+00:00:00","","","","+00:00:00"
"Indian/Cocos","+0630","+0630","","","+06:30:00","+00:00:00","","","","+00:00:00"
"Indian/Comoro","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Indian/Kerguelen","TFT","TFT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mahe","SCT","SCT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Indian/Maldives","MVT","MVT","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mauritius","MUT","MUT","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Indian/Kerguelen","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mahe","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Indian/Maldives","+05","+05","","","+05:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mauritius","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Indian/Mayotte","EAT","EAT","","","+03:00:00","+00:00:00","","","","+00:00:00"
"Indian/Reunion","RET","RET","","","+04:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Apia","WST","WST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Auckland","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","1;0;10","+02:00:00","3;0;3","+03:00:00"
"Pacific/Chatham","CHAST","CHAST","CHADT","CHADT","+12:45:00","+01:00:00","1;0;10","+02:45:00","3;0;3","+03:45:00"
"Pacific/Easter","EAST","EAST","EASST","EASST","-06:00:00","+01:00:00","2;6;10","+22:00:00","2;6;3","+22:00:00"
"Pacific/Efate","VUT","VUT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Enderbury","PHOT","PHOT","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fakaofo","TKT","TKT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fiji","FJT","FJT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Funafuti","TVT","TVT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Galapagos","GALT","GALT","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Gambier","GAMT","GAMT","","","-09:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Guadalcanal","SBT","SBT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Indian/Reunion","+04","+04","","","+04:00:00","+00:00:00","","","","+00:00:00"
"MET","MET","MET","MEST","MEST","+01:00:00","+01:00:00","-1;0;3","+02:00:00","-1;0;10","+03:00:00"
"MST","MST","MST","","","-07:00:00","+00:00:00","","","","+00:00:00"
"MST7MDT","MST","MST","MDT","MDT","-07:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"Pacific/Apia","+13","+13","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Auckland","NZST","NZST","NZDT","NZDT","+12:00:00","+01:00:00","-1;0;9","+02:00:00","1;0;4","+03:00:00"
"Pacific/Bougainville","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Chatham","+1245","+1245","+1345","+1345","+12:45:00","+01:00:00","-1;0;9","+02:45:00","1;0;4","+03:45:00"
"Pacific/Chuuk","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Easter","-06","-06","-05","-05","-06:00:00","+01:00:00","1;0;9","+21:00:00","1;0;4","+23:00:00"
"Pacific/Efate","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fakaofo","+13","+13","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Fiji","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Funafuti","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Galapagos","-06","-06","","","-06:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Gambier","-09","-09","","","-09:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Guadalcanal","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Guam","ChST","ChST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Honolulu","HST","HST","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Johnston","HST","HST","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kiritimati","LINT","LINT","","","+14:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kosrae","KOST","KOST","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kwajalein","MHT","MHT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Majuro","MHT","MHT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Marquesas","MART","MART","","","-09:30:00","+00:00:00","","","","+00:00:00"
"Pacific/Kanton","+13","+13","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kiritimati","+14","+14","","","+14:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kosrae","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Kwajalein","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Majuro","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Marquesas","-0930","-0930","","","-09:30:00","+00:00:00","","","","+00:00:00"
"Pacific/Midway","SST","SST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Nauru","NRT","NRT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Niue","NUT","NUT","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Norfolk","NFT","NFT","","","+11:30:00","+00:00:00","","","","+00:00:00"
"Pacific/Noumea","NCT","NCT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Nauru","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Niue","-11","-11","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Norfolk","+11","+11","+12","+12","+11:00:00","+01:00:00","1;0;10","+02:00:00","1;0;4","+03:00:00"
"Pacific/Noumea","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pago_Pago","SST","SST","","","-11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Palau","PWT","PWT","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pitcairn","PST","PST","","","-08:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Ponape","PONT","PONT","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Port_Moresby","PGT","PGT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Rarotonga","CKT","CKT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Palau","+09","+09","","","+09:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pitcairn","-08","-08","","","-08:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Pohnpei","+11","+11","","","+11:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Port_Moresby","+10","+10","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Rarotonga","-10","-10","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Saipan","ChST","ChST","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tahiti","TAHT","TAHT","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tarawa","GILT","GILT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tongatapu","TOT","TOT","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Truk","TRUT","TRUT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wake","WAKT","WAKT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wallis","WFT","WFT","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Yap","YAPT","YAPT","","","+10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tahiti","-10","-10","","","-10:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tarawa","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Tongatapu","+13","+13","","","+13:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wake","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"Pacific/Wallis","+12","+12","","","+12:00:00","+00:00:00","","","","+00:00:00"
"PST8PDT","PST","PST","PDT","PDT","-08:00:00","+01:00:00","2;0;3","+02:00:00","1;0;11","+02:00:00"
"WET","WET","WET","WEST","WEST","+00:00:00","+01:00:00","-1;0;3","+01:00:00","-1;0;10","+02:00:00"
1 ID STD ABBR STD NAME DST ABBR DST NAME GMT offset DST adjustment DST Start Date rule Start time DST End date rule End time
3 Africa/Accra GMT GMT +00:00:00 +00:00:00 +00:00:00
4 Africa/Addis_Ababa EAT EAT +03:00:00 +00:00:00 +00:00:00
5 Africa/Algiers CET CET +01:00:00 +00:00:00 +00:00:00
6 Africa/Asmera Africa/Asmara EAT EAT +03:00:00 +00:00:00 +00:00:00
7 Africa/Bamako GMT GMT +00:00:00 +00:00:00 +00:00:00
8 Africa/Bangui WAT WAT +01:00:00 +00:00:00 +00:00:00
9 Africa/Banjul GMT GMT +00:00:00 +00:00:00 +00:00:00
11 Africa/Blantyre CAT CAT +02:00:00 +00:00:00 +00:00:00
12 Africa/Brazzaville WAT WAT +01:00:00 +00:00:00 +00:00:00
13 Africa/Bujumbura CAT CAT +02:00:00 +00:00:00 +00:00:00
14 Africa/Cairo EET EET EEST EEST +02:00:00 +01:00:00 -1;5;4 +00:00:00 -1;5;9 -1;4;10 +00:00:00
15 Africa/Casablanca WET +01 WET +01 +00 +00 +00:00:00 +01:00:00 +00:00:00 -01:00:00 -1;0;2 +02:00:00 1;0;4 +00:00:00 +03:00:00
16 Africa/Ceuta CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
17 Africa/Conakry GMT GMT +00:00:00 +00:00:00 +00:00:00
18 Africa/Dakar GMT GMT +00:00:00 +00:00:00 +00:00:00
19 Africa/Dar_es_Salaam EAT EAT +03:00:00 +00:00:00 +00:00:00
20 Africa/Djibouti EAT EAT +03:00:00 +00:00:00 +00:00:00
21 Africa/Douala WAT WAT +01:00:00 +00:00:00 +00:00:00
22 Africa/El_Aaiun WET +01 WET +01 +00 +00 +00:00:00 +01:00:00 +00:00:00 -01:00:00 -1;0;2 +02:00:00 1;0;4 +00:00:00 +03:00:00
23 Africa/Freetown GMT GMT +00:00:00 +00:00:00 +00:00:00
24 Africa/Gaborone CAT CAT +02:00:00 +00:00:00 +00:00:00
25 Africa/Harare CAT CAT +02:00:00 +00:00:00 +00:00:00
26 Africa/Johannesburg SAST SAST +02:00:00 +00:00:00 +00:00:00
27 Africa/Juba CAT CAT +02:00:00 +00:00:00 +00:00:00
28 Africa/Kampala EAT EAT +03:00:00 +00:00:00 +00:00:00
29 Africa/Khartoum EAT CAT EAT CAT +03:00:00 +02:00:00 +00:00:00 +00:00:00
30 Africa/Kigali CAT CAT +02:00:00 +00:00:00 +00:00:00
31 Africa/Kinshasa WAT WAT +01:00:00 +00:00:00 +00:00:00
32 Africa/Lagos WAT WAT +01:00:00 +00:00:00 +00:00:00
48 Africa/Ouagadougou GMT GMT +00:00:00 +00:00:00 +00:00:00
49 Africa/Porto-Novo WAT WAT +01:00:00 +00:00:00 +00:00:00
50 Africa/Sao_Tome GMT GMT +00:00:00 +00:00:00 +00:00:00
Africa/Timbuktu GMT GMT +00:00:00 +00:00:00 +00:00:00
51 Africa/Tripoli EET EET +02:00:00 +00:00:00 +00:00:00
52 Africa/Tunis CET CET +01:00:00 +00:00:00 +00:00:00
53 Africa/Windhoek WAT CAT WAT CAT WAST WAST +01:00:00 +02:00:00 +01:00:00 +00:00:00 1;0;9 +02:00:00 1;0;4 +02:00:00 +00:00:00
54 America/Adak HAST HST HAST HST HADT HDT HADT HDT -10:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
55 America/Anchorage AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
56 America/Anguilla AST AST -04:00:00 +00:00:00 +00:00:00
57 America/Antigua AST AST -04:00:00 +00:00:00 +00:00:00
58 America/Araguaina BRT -03 BRT -03 BRST BRST -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
59 America/Argentina/Buenos_Aires -03 -03 -03:00:00 +00:00:00 +00:00:00
60 America/Argentina/Catamarca -03 -03 -03:00:00 +00:00:00 +00:00:00
61 America/Argentina/Cordoba -03 -03 -03:00:00 +00:00:00 +00:00:00
62 America/Argentina/Jujuy -03 -03 -03:00:00 +00:00:00 +00:00:00
63 America/Argentina/La_Rioja -03 -03 -03:00:00 +00:00:00 +00:00:00
64 America/Argentina/Mendoza -03 -03 -03:00:00 +00:00:00 +00:00:00
65 America/Argentina/Rio_Gallegos -03 -03 -03:00:00 +00:00:00 +00:00:00
66 America/Argentina/Salta -03 -03 -03:00:00 +00:00:00 +00:00:00
67 America/Argentina/San_Juan -03 -03 -03:00:00 +00:00:00 +00:00:00
68 America/Argentina/San_Luis -03 -03 -03:00:00 +00:00:00 +00:00:00
69 America/Argentina/Tucuman -03 -03 -03:00:00 +00:00:00 +00:00:00
70 America/Argentina/Ushuaia -03 -03 -03:00:00 +00:00:00 +00:00:00
71 America/Aruba AST AST -04:00:00 +00:00:00 +00:00:00
72 America/Asuncion PYT -03 PYT -03 PYST PYST -04:00:00 -03:00:00 +01:00:00 +00:00:00 1;0;10 +00:00:00 1;0;3 +00:00:00
73 America/Atikokan EST EST -05:00:00 +00:00:00 +00:00:00
74 America/Bahia -03 -03 -03:00:00 +00:00:00 +00:00:00
75 America/Bahia_Banderas CST CST -06:00:00 +00:00:00 +00:00:00
76 America/Barbados AST AST -04:00:00 +00:00:00 +00:00:00
77 America/Belem BRT -03 BRT -03 -03:00:00 +00:00:00 +00:00:00
78 America/Belize CST CST -06:00:00 +00:00:00 +00:00:00
79 America/Boa_Vista America/Blanc-Sablon AMT AST AMT AST -04:00:00 +00:00:00 +00:00:00
80 America/Bogota America/Boa_Vista COT -04 COT -04 -05:00:00 -04:00:00 +00:00:00 +00:00:00
81 America/Bogota -05 -05 -05:00:00 +00:00:00 +00:00:00
82 America/Boise MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Buenos_Aires ART ART -03:00:00 +00:00:00 +00:00:00
83 America/Cambridge_Bay MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
84 America/Cancun America/Campo_Grande CST -04 CST -04 CDT CDT -06:00:00 -04:00:00 +01:00:00 +00:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00 +00:00:00
85 America/Caracas America/Cancun VET EST VET EST -04:00:00 -05:00:00 +00:00:00 +00:00:00
86 America/Catamarca America/Caracas ART -04 ART -04 -03:00:00 -04:00:00 +00:00:00 +00:00:00
87 America/Cayenne GFT -03 GFT -03 -03:00:00 +00:00:00 +00:00:00
88 America/Cayman EST EST -05:00:00 +00:00:00 +00:00:00
89 America/Chicago CST Central Standard Time CST CDT Central Daylight Time CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
90 America/Chihuahua MST CST MST CST MDT MDT -07:00:00 -06:00:00 +01:00:00 +00:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00 +00:00:00
91 America/Cordoba America/Ciudad_Juarez ART MST ART MST MDT MDT -03:00:00 -07:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
92 America/Costa_Rica CST CST -06:00:00 +00:00:00 +00:00:00
93 America/Cuiaba America/Coyhaique AMT -03 AMT -03 AMST AMST -04:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
94 America/Creston MST MST -07:00:00 +00:00:00 +00:00:00
95 America/Cuiaba -04 -04 -04:00:00 +00:00:00 +00:00:00
96 America/Curacao AST AST -04:00:00 +00:00:00 +00:00:00
97 America/Danmarkshavn GMT GMT +00:00:00 +00:00:00 +00:00:00
98 America/Dawson PST MST PST MST PDT PDT -08:00:00 -07:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
99 America/Dawson_Creek MST MST -07:00:00 +00:00:00 +00:00:00
100 America/Denver MST Mountain Standard Time MST MDT Mountain Daylight Time MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
101 America/Detroit EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
102 America/Dominica AST AST -04:00:00 +00:00:00 +00:00:00
103 America/Edmonton MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
104 America/Eirunepe ACT -05 ACT -05 -05:00:00 +00:00:00 +00:00:00
105 America/El_Salvador CST CST -06:00:00 +00:00:00 +00:00:00
106 America/Fortaleza BRT -03 BRT -03 BRST BRST -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
107 America/Fort_Nelson MST MST -07:00:00 +00:00:00 +00:00:00
108 America/Glace_Bay AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
109 America/Godthab America/Goose_Bay WGT AST WGT AST WGST ADT WGST ADT -03:00:00 -04:00:00 +01:00:00 -1;6;3 2;0;3 +22:00:00 +02:00:00 -1;6;10 1;0;11 +23:00:00 +02:00:00
110 America/Goose_Bay America/Grand_Turk AST EST AST EST ADT EDT ADT EDT -04:00:00 -05:00:00 +01:00:00 1;0;4 2;0;3 +00:01:00 +02:00:00 -1;0;10 1;0;11 +00:01:00 +02:00:00
America/Grand_Turk EST EST EDT EDT -05:00:00 +01:00:00 1;0;4 +00:00:00 -1;0;10 +00:00:00
111 America/Grenada AST AST -04:00:00 +00:00:00 +00:00:00
112 America/Guadeloupe AST AST -04:00:00 +00:00:00 +00:00:00
113 America/Guatemala CST CST -06:00:00 +00:00:00 +00:00:00
114 America/Guayaquil ECT -05 ECT -05 -05:00:00 +00:00:00 +00:00:00
115 America/Guyana GYT -04 GYT -04 -04:00:00 +00:00:00 +00:00:00
116 America/Halifax AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
117 America/Havana CST CST CDT CDT -05:00:00 +01:00:00 1;0;4 2;0;3 +00:00:00 -1;0;10 1;0;11 +01:00:00
118 America/Hermosillo MST MST -07:00:00 +00:00:00 +00:00:00
119 America/Indiana/Indianapolis EST EST EDT EDT -05:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
120 America/Indiana/Knox EST CST EST CST CDT CDT -05:00:00 -06:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
121 America/Indiana/Marengo EST EST EDT EDT -05:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
122 America/Indiana/Vevay America/Indiana/Petersburg EST EST EDT EDT -05:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
123 America/Indianapolis America/Indiana/Tell_City EST CST EST CST CDT CDT -05:00:00 -06:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
124 America/Indiana/Vevay EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
125 America/Indiana/Vincennes EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
126 America/Indiana/Winamac EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
127 America/Inuvik MST MST MDT MDT -07:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
128 America/Iqaluit EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
129 America/Jamaica EST EST -05:00:00 +00:00:00 +00:00:00
America/Jujuy ART ART -03:00:00 +00:00:00 +00:00:00
130 America/Juneau AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
131 America/Kentucky/Louisville EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
132 America/Kentucky/Monticello EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
133 America/La_Paz BOT -04 BOT -04 -04:00:00 +00:00:00 +00:00:00
134 America/Lima PET -05 PET -05 -05:00:00 +00:00:00 +00:00:00
135 America/Los_Angeles PST Pacific Standard Time PST PDT Pacific Daylight Time PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
136 America/Louisville America/Maceio EST -03 EST -03 EDT EDT -05:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
America/Maceio BRT BRT BRST BRST -03:00:00 +01:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
137 America/Managua CST CST -06:00:00 +00:00:00 +00:00:00
138 America/Manaus AMT -04 AMT -04 -04:00:00 +00:00:00 +00:00:00
139 America/Martinique AST AST -04:00:00 +00:00:00 +00:00:00
140 America/Mazatlan America/Matamoros MST CST MST CST MDT CDT MDT CDT -07:00:00 -06:00:00 +01:00:00 1;0;4 2;0;3 +02:00:00 -1;0;10 1;0;11 +02:00:00
141 America/Mendoza America/Mazatlan ART MST ART MST -03:00:00 -07:00:00 +00:00:00 +00:00:00
142 America/Menominee CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
143 America/Merida CST CST CDT CDT -06:00:00 +01:00:00 +00:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00 +00:00:00
144 America/Mexico_City America/Metlakatla CST AKST CST AKST CDT AKDT CDT AKDT -06:00:00 -09:00:00 +01:00:00 1;0;4 2;0;3 +02:00:00 -1;0;10 1;0;11 +02:00:00
145 America/Miquelon America/Mexico_City PMST CST PMST CST PMDT PMDT -03:00:00 -06:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
146 America/Monterrey America/Miquelon CST -03 CST -03 CDT -02 CDT -02 -06:00:00 -03:00:00 +01:00:00 1;0;4 2;0;3 +02:00:00 -1;0;10 1;0;11 +02:00:00
147 America/Montevideo America/Moncton UYT AST UYT AST ADT ADT -03:00:00 -04:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
148 America/Montreal America/Monterrey EST CST EST CST EDT EDT -05:00:00 -06:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
149 America/Montevideo -03 -03 -03:00:00 +00:00:00 +00:00:00
150 America/Montserrat AST AST -04:00:00 +00:00:00 +00:00:00
151 America/Nassau EST EST EDT EDT -05:00:00 +01:00:00 1;0;4 2;0;3 +02:00:00 -1;0;10 1;0;11 +02:00:00
152 America/New_York EST Eastern Standard Time EST EDT Eastern Daylight Time EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
America/Nipigon EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
153 America/Nome AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
154 America/Noronha FNT -02 FNT -02 -02:00:00 +00:00:00 +00:00:00
155 America/North_Dakota/Beulah CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
156 America/North_Dakota/Center CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
157 America/North_Dakota/New_Salem CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
158 America/Nuuk -02 -02 -01 -01 -02:00:00 +01:00:00 -1;0;3 +23:00:00 -1;0;10 +00:00:00
159 America/Ojinaga CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
160 America/Panama EST EST -05:00:00 +00:00:00 +00:00:00
161 America/Pangnirtung America/Paramaribo EST -03 EST -03 EDT EDT -05:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
162 America/Paramaribo America/Phoenix SRT MST SRT MST -03:00:00 -07:00:00 +00:00:00 +00:00:00
163 America/Phoenix America/Port-au-Prince MST EST Mountain Standard Time EST EDT EDT -07:00:00 -05:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
America/Port-au-Prince EST EST -05:00:00 +00:00:00 +00:00:00
164 America/Port_of_Spain AST AST -04:00:00 +00:00:00 +00:00:00
165 America/Porto_Velho AMT -04 AMT -04 -04:00:00 +00:00:00 +00:00:00
166 America/Puerto_Rico AST AST -04:00:00 +00:00:00 +00:00:00
167 America/Rainy_River America/Punta_Arenas CST -03 CST -03 CDT CDT -06:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
168 America/Rankin_Inlet CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
169 America/Recife BRT -03 BRT -03 BRST BRST -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
170 America/Regina CST CST -06:00:00 +00:00:00 +00:00:00
171 America/Rio_Branco America/Resolute ACT CST ACT CST CDT CDT -05:00:00 -06:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
172 America/Rosario America/Rio_Branco ART -05 ART -05 -03:00:00 -05:00:00 +00:00:00 +00:00:00
173 America/Santiago America/Santarem CLT -03 CLT -03 CLST CLST -04:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 2;0;3 +00:00:00
174 America/Santiago -04 -04 -03 -03 -04:00:00 +01:00:00 1;0;9 +23:00:00 1;0;4 +01:00:00
175 America/Santo_Domingo AST AST -04:00:00 +00:00:00 +00:00:00
176 America/Sao_Paulo BRT -03 BRT -03 BRST BRST -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 3;0;2 +00:00:00
177 America/Scoresbysund EGT -02 EGT -02 EGST -01 EGST -01 -01:00:00 -02:00:00 +01:00:00 -1;0;3 +00:00:00 +23:00:00 -1;0;10 +01:00:00 +00:00:00
178 America/Shiprock America/Sitka MST AKST MST AKST MDT AKDT MDT AKDT -07:00:00 -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
179 America/St_Johns NST NST NDT NDT -03:30:00 +01:00:00 1;0;4 2;0;3 +00:01:00 +02:00:00 -1;0;10 1;0;11 +00:01:00 +02:00:00
180 America/St_Kitts AST AST -04:00:00 +00:00:00 +00:00:00
181 America/St_Lucia AST AST -04:00:00 +00:00:00 +00:00:00
182 America/St_Thomas AST AST -04:00:00 +00:00:00 +00:00:00
183 America/St_Vincent AST AST -04:00:00 +00:00:00 +00:00:00
184 America/Swift_Current CST CST -06:00:00 +00:00:00 +00:00:00
185 America/Tegucigalpa CST CST -06:00:00 +00:00:00 +00:00:00
186 America/Thule AST AST ADT ADT -04:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
187 America/Thunder_Bay America/Tijuana EST PST EST PST EDT PDT EDT PDT -05:00:00 -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
188 America/Tijuana America/Toronto PST EST PST EST PDT EDT PDT EDT -08:00:00 -05:00:00 +01:00:00 1;0;4 2;0;3 +02:00:00 -1;0;10 1;0;11 +02:00:00
189 America/Tortola AST AST -04:00:00 +00:00:00 +00:00:00
190 America/Vancouver PST PST PDT PDT -08:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
191 America/Whitehorse PST MST PST MST PDT PDT -08:00:00 -07:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
192 America/Winnipeg CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +03:00:00 +02:00:00
193 America/Yakutat AKST AKST AKDT AKDT -09:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
194 America/Yellowknife Antarctica/Casey MST +08 MST +08 MDT MDT -07:00:00 +08:00:00 +01:00:00 +00:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00 +00:00:00
195 Antarctica/Casey Antarctica/Davis WST +07 WST +07 +08:00:00 +07:00:00 +00:00:00 +00:00:00
196 Antarctica/Davis Antarctica/DumontDUrville DAVT +10 DAVT +10 +07:00:00 +10:00:00 +00:00:00 +00:00:00
197 Antarctica/DumontDUrville Antarctica/Macquarie DDUT AEST DDUT AEST AEDT AEDT +10:00:00 +00:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +00:00:00 +03:00:00
198 Antarctica/Mawson MAWT +05 MAWT +05 +06:00:00 +05:00:00 +00:00:00 +00:00:00
199 Antarctica/McMurdo NZST NZST NZDT NZDT +12:00:00 +01:00:00 1;0;10 -1;0;9 +02:00:00 3;0;3 1;0;4 +03:00:00
200 Antarctica/Palmer CLT -03 CLT -03 CLST CLST -04:00:00 -03:00:00 +01:00:00 +00:00:00 2;0;10 +00:00:00 2;0;3 +00:00:00
201 Antarctica/South_Pole Antarctica/Rothera NZST -03 NZST -03 NZDT NZDT +12:00:00 -03:00:00 +01:00:00 +00:00:00 1;0;10 +02:00:00 3;0;3 +03:00:00 +00:00:00
202 Antarctica/Syowa SYOT +03 SYOT +03 +03:00:00 +00:00:00 +00:00:00
203 Antarctica/Vostok Antarctica/Troll VOST +00 VOST +00 +02 +02 +06:00:00 +00:00:00 +00:00:00 +02:00:00 -1;0;3 +01:00:00 -1;0;10 +00:00:00 +03:00:00
204 Arctic/Longyearbyen Antarctica/Vostok CET +05 CET +05 CEST CEST +01:00:00 +05:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
205 Asia/Aden AST +03 AST +03 +03:00:00 +00:00:00 +00:00:00
206 Asia/Almaty ALMT +05 ALMT +05 ALMST ALMST +06:00:00 +05:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
207 Asia/Amman EET +03 EET +03 EEST EEST +02:00:00 +03:00:00 +01:00:00 +00:00:00 -1;4;3 +00:00:00 -1;4;9 +01:00:00 +00:00:00
208 Asia/Anadyr ANAT +12 ANAT +12 ANAST ANAST +12:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
209 Asia/Aqtau AQTT +05 AQTT +05 AQTST AQTST +04:00:00 +05:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
210 Asia/Aqtobe AQTT +05 AQTT +05 AQTST AQTST +05:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
211 Asia/Ashgabat TMT +05 TMT +05 +05:00:00 +00:00:00 +00:00:00
212 Asia/Baghdad Asia/Atyrau AST +05 AST +05 ADT ADT +03:00:00 +05:00:00 +01:00:00 +00:00:00 1;0;4 +03:00:00 1;0;10 +04:00:00 +00:00:00
213 Asia/Bahrain Asia/Baghdad AST +03 AST +03 +03:00:00 +00:00:00 +00:00:00
214 Asia/Baku Asia/Bahrain AZT +03 AZT +03 AZST AZST +04:00:00 +03:00:00 +01:00:00 +00:00:00 -1;0;3 +01:00:00 -1;0;10 +01:00:00 +00:00:00
215 Asia/Bangkok Asia/Baku ICT +04 ICT +04 +07:00:00 +04:00:00 +00:00:00 +00:00:00
216 Asia/Beirut Asia/Bangkok EET +07 EET +07 EEST EEST +02:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
217 Asia/Bishkek Asia/Barnaul KGT +07 KGT +07 KGST KGST +05:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +02:30:00 -1;0;10 +02:30:00 +00:00:00
218 Asia/Brunei Asia/Beirut BNT EET BNT EET EEST EEST +08:00:00 +02:00:00 +00:00:00 +01:00:00 -1;0;3 +00:00:00 -1;6;10 +00:00:00
219 Asia/Calcutta Asia/Bishkek IST +06 IST +06 +05:30:00 +06:00:00 +00:00:00 +00:00:00
220 Asia/Choibalsan Asia/Brunei CHOT +08 CHOT +08 +09:00:00 +08:00:00 +00:00:00 +00:00:00
221 Asia/Chongqing Asia/Chita CST +09 CST +09 +08:00:00 +09:00:00 +00:00:00 +00:00:00
222 Asia/Colombo LKT +0530 LKT +0530 +06:00:00 +05:30:00 +00:00:00 +00:00:00
223 Asia/Damascus EET +03 EET +03 EEST EEST +02:00:00 +03:00:00 +01:00:00 +00:00:00 1;0;4 +00:00:00 1;0;10 +00:00:00
224 Asia/Dhaka BDT +06 BDT +06 +06:00:00 +00:00:00 +00:00:00
225 Asia/Dili TPT +09 TPT +09 +09:00:00 +00:00:00 +00:00:00
226 Asia/Dubai GST +04 GST +04 +04:00:00 +00:00:00 +00:00:00
227 Asia/Dushanbe TJT +05 TJT +05 +05:00:00 +00:00:00 +00:00:00
228 Asia/Gaza Asia/Famagusta EET EET EEST EEST +02:00:00 +01:00:00 3;5;4 -1;0;3 +00:00:00 +03:00:00 3;5;10 -1;0;10 +00:00:00 +04:00:00
229 Asia/Harbin Asia/Gaza CST EET CST EET EEST EEST +08:00:00 +02:00:00 +00:00:00 +01:00:00 2;6;4 +02:00:00 -1;6;10 +00:00:00 +02:00:00
230 Asia/Hebron EET EET EEST EEST +02:00:00 +01:00:00 2;6;4 +02:00:00 -1;6;10 +02:00:00
231 Asia/Ho_Chi_Minh +07 +07 +07:00:00 +00:00:00 +00:00:00
232 Asia/Hong_Kong HKT HKT +08:00:00 +00:00:00 +00:00:00
233 Asia/Hovd HOVT +07 HOVT +07 +07:00:00 +00:00:00 +00:00:00
234 Asia/Irkutsk IRKT +08 IRKT +08 IRKST IRKST +08:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
235 Asia/Istanbul Asia/Jakarta EET WIB EET WIB EEST EEST +02:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +00:00:00
236 Asia/Jakarta Asia/Jayapura WIT WIT +07:00:00 +09:00:00 +00:00:00 +00:00:00
237 Asia/Jayapura Asia/Jerusalem EIT IST EIT IST IDT IDT +09:00:00 +02:00:00 +00:00:00 +01:00:00 -1;5;3 +02:00:00 -1;0;10 +00:00:00 +02:00:00
238 Asia/Jerusalem Asia/Kabul IST +0430 IST +0430 IDT IDT +02:00:00 +04:30:00 +01:00:00 +00:00:00 1;0;4 +01:00:00 1;0;10 +01:00:00 +00:00:00
239 Asia/Kabul Asia/Kamchatka AFT +12 AFT +12 +04:30:00 +12:00:00 +00:00:00 +00:00:00
Asia/Kamchatka PETT PETT PETST PETST +12:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
240 Asia/Karachi PKT PKT +05:00:00 +00:00:00 +00:00:00
241 Asia/Kashgar Asia/Kathmandu CST +0545 CST +0545 +08:00:00 +05:45:00 +00:00:00 +00:00:00
242 Asia/Katmandu Asia/Khandyga NPT +09 NPT +09 +05:45:00 +09:00:00 +00:00:00 +00:00:00
243 Asia/Krasnoyarsk Asia/Kolkata KRAT IST KRAT IST KRAST KRAST +07:00:00 +05:30:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
244 Asia/Kuala_Lumpur Asia/Krasnoyarsk MYT +07 MYT +07 +08:00:00 +07:00:00 +00:00:00 +00:00:00
245 Asia/Kuching Asia/Kuala_Lumpur MYT +08 MYT +08 +08:00:00 +00:00:00 +00:00:00
246 Asia/Kuwait Asia/Kuching AST +08 AST +08 +03:00:00 +08:00:00 +00:00:00 +00:00:00
247 Asia/Macao Asia/Kuwait CST +03 CST +03 +08:00:00 +03:00:00 +00:00:00 +00:00:00
248 Asia/Macau CST CST +08:00:00 +00:00:00 +00:00:00
249 Asia/Magadan MAGT +11 MAGT +11 MAGST MAGST +11:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
250 Asia/Makassar CIT WITA CIT WITA +08:00:00 +00:00:00 +00:00:00
251 Asia/Manila PHT PST PHT PST +08:00:00 +00:00:00 +00:00:00
252 Asia/Muscat GST +04 GST +04 +04:00:00 +00:00:00 +00:00:00
253 Asia/Nicosia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
254 Asia/Novosibirsk Asia/Novokuznetsk NOVT +07 NOVT +07 NOVST NOVST +06:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
255 Asia/Omsk Asia/Novosibirsk OMST +07 OMST +07 OMSST OMSST +06:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
256 Asia/Oral Asia/Omsk WST +06 WST +06 +05:00:00 +06:00:00 +00:00:00 +00:00:00
257 Asia/Phnom_Penh Asia/Oral ICT +05 ICT +05 +07:00:00 +05:00:00 +00:00:00 +00:00:00
258 Asia/Pontianak Asia/Phnom_Penh WIT +07 WIT +07 +07:00:00 +00:00:00 +00:00:00
259 Asia/Pontianak WIB WIB +07:00:00 +00:00:00 +00:00:00
260 Asia/Pyongyang KST KST +09:00:00 +00:00:00 +00:00:00
261 Asia/Qyzylorda Asia/Qatar KST +03 KST +03 +06:00:00 +03:00:00 +00:00:00 +00:00:00
262 Asia/Qatar Asia/Qostanay AST +05 AST +05 +03:00:00 +05:00:00 +00:00:00 +00:00:00
263 Asia/Rangoon Asia/Qyzylorda MMT +05 MMT +05 +06:30:00 +05:00:00 +00:00:00 +00:00:00
264 Asia/Riyadh AST +03 AST +03 +03:00:00 +00:00:00 +00:00:00
265 Asia/Saigon Asia/Sakhalin ICT +11 ICT +11 +07:00:00 +11:00:00 +00:00:00 +00:00:00
266 Asia/Sakhalin Asia/Samarkand SAKT +05 SAKT +05 SAKST SAKST +10:00:00 +05:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
Asia/Samarkand UZT UZT +05:00:00 +00:00:00 +00:00:00
267 Asia/Seoul KST KST +09:00:00 +00:00:00 +00:00:00
268 Asia/Shanghai CST CST +08:00:00 +00:00:00 +00:00:00
269 Asia/Singapore SGT +08 SGT +08 +08:00:00 +00:00:00 +00:00:00
270 Asia/Srednekolymsk +11 +11 +11:00:00 +00:00:00 +00:00:00
271 Asia/Taipei CST CST +08:00:00 +00:00:00 +00:00:00
272 Asia/Tashkent UZT +05 UZT +05 +05:00:00 +00:00:00 +00:00:00
273 Asia/Tbilisi GET +04 GET +04 GEST GEST +04:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +00:00:00
274 Asia/Tehran IRT +0330 IRT +0330 +03:30:00 +00:00:00 +00:00:00
275 Asia/Thimphu BTT +06 BTT +06 +06:00:00 +00:00:00 +00:00:00
276 Asia/Tokyo JST JST +09:00:00 +00:00:00 +00:00:00
277 Asia/Ujung_Pandang Asia/Tomsk CIT +07 CIT +07 +08:00:00 +07:00:00 +00:00:00 +00:00:00
278 Asia/Ulaanbaatar ULAT +08 ULAT +08 +08:00:00 +00:00:00 +00:00:00
279 Asia/Urumqi CST +06 CST +06 +08:00:00 +06:00:00 +00:00:00 +00:00:00
280 Asia/Vientiane Asia/Ust-Nera ICT +10 ICT +10 +07:00:00 +10:00:00 +00:00:00 +00:00:00
281 Asia/Vladivostok Asia/Vientiane VLAT +07 VLAT +07 VLAST VLAST +10:00:00 +07:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
282 Asia/Yakutsk Asia/Vladivostok YAKT +10 YAKT +10 YAKST YAKST +09:00:00 +10:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
283 Asia/Yekaterinburg Asia/Yakutsk YEKT +09 YEKT +09 YEKST YEKST +05:00:00 +09:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
284 Asia/Yerevan Asia/Yangon AMT +0630 AMT +0630 AMST AMST +04:00:00 +06:30:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
285 Atlantic/Azores Asia/Yekaterinburg AZOT +05 AZOT +05 AZOST AZOST -01:00:00 +05:00:00 +01:00:00 +00:00:00 -1;0;3 +00:00:00 -1;0;10 +01:00:00 +00:00:00
286 Atlantic/Bermuda Asia/Yerevan AST +04 AST +04 ADT ADT -04:00:00 +04:00:00 +01:00:00 +00:00:00 1;0;4 +02:00:00 -1;0;10 +02:00:00 +00:00:00
287 Atlantic/Azores -01 -01 +00 +00 -01:00:00 +01:00:00 -1;0;3 +00:00:00 -1;0;10 +01:00:00
288 Atlantic/Bermuda AST AST ADT ADT -04:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
289 Atlantic/Canary WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
290 Atlantic/Cape_Verde CVT -01 CVT -01 -01:00:00 +00:00:00 +00:00:00
291 Atlantic/Faeroe Atlantic/Faroe WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
Atlantic/Jan_Mayen CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
292 Atlantic/Madeira WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
293 Atlantic/Reykjavik GMT GMT +00:00:00 +00:00:00 +00:00:00
294 Atlantic/South_Georgia GST -02 GST -02 -02:00:00 +00:00:00 +00:00:00
295 Atlantic/Stanley -03 -03 -03:00:00 +00:00:00 +00:00:00
296 Atlantic/St_Helena GMT GMT +00:00:00 +00:00:00 +00:00:00
297 Atlantic/Stanley Australia/Adelaide FKT ACST FKT ACST FKST ACDT FKST ACDT -04:00:00 +09:30:00 +01:00:00 1;0;9 1;0;10 +02:00:00 3;0;4 1;0;4 +02:00:00 +03:00:00
298 Australia/Adelaide Australia/Brisbane CST AEST CST AEST CST CST +09:30:00 +10:00:00 +01:00:00 +00:00:00 -1;0;10 +02:00:00 -1;0;3 +03:00:00 +00:00:00
299 Australia/Brisbane Australia/Broken_Hill EST ACST EST ACST ACDT ACDT +10:00:00 +09:30:00 +00:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +00:00:00 +03:00:00
300 Australia/Broken_Hill Australia/Darwin CST ACST CST ACST CST CST +09:30:00 +01:00:00 +00:00:00 -1;0;10 +02:00:00 -1;0;3 +03:00:00 +00:00:00
301 Australia/Darwin Australia/Eucla CST +0845 CST +0845 +09:30:00 +08:45:00 +00:00:00 +00:00:00
302 Australia/Hobart EST AEST EST AEST EST AEDT EST AEDT +10:00:00 +01:00:00 1;0;10 +02:00:00 -1;0;3 1;0;4 +03:00:00
303 Australia/Lindeman EST AEST EST AEST +10:00:00 +00:00:00 +00:00:00
304 Australia/Lord_Howe LHST +1030 LHST +1030 LHST +11 LHST +11 +10:30:00 +00:30:00 -1;0;10 1;0;10 +02:00:00 -1;0;3 1;0;4 +02:00:00
305 Australia/Melbourne EST AEST EST AEST EST AEDT EST AEDT +10:00:00 +01:00:00 -1;0;10 1;0;10 +02:00:00 -1;0;3 1;0;4 +03:00:00
306 Australia/Perth WST AWST WST AWST +08:00:00 +00:00:00 +00:00:00
307 Australia/Sydney EST AEST EST AEST EST AEDT EST AEDT +10:00:00 +01:00:00 -1;0;10 1;0;10 +02:00:00 -1;0;3 1;0;4 +03:00:00
308 CET CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
309 CST6CDT CST CST CDT CDT -06:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
310 EET EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
311 EST EST EST -05:00:00 +00:00:00 +00:00:00
312 EST5EDT EST EST EDT EDT -05:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +02:00:00
313 Etc/GMT GMT GMT +00:00:00 +00:00:00 +00:00:00
314 Etc/GMT+1 -01 -01 -01:00:00 +00:00:00 +00:00:00
315 Etc/GMT-1 +01 +01 +01:00:00 +00:00:00 +00:00:00
316 Etc/GMT+10 -10 -10 -10:00:00 +00:00:00 +00:00:00
317 Etc/GMT-10 +10 +10 +10:00:00 +00:00:00 +00:00:00
318 Etc/GMT+11 -11 -11 -11:00:00 +00:00:00 +00:00:00
319 Etc/GMT-11 +11 +11 +11:00:00 +00:00:00 +00:00:00
320 Etc/GMT+12 -12 -12 -12:00:00 +00:00:00 +00:00:00
321 Etc/GMT-12 +12 +12 +12:00:00 +00:00:00 +00:00:00
322 Etc/GMT-13 +13 +13 +13:00:00 +00:00:00 +00:00:00
323 Etc/GMT-14 +14 +14 +14:00:00 +00:00:00 +00:00:00
324 Etc/GMT+2 -02 -02 -02:00:00 +00:00:00 +00:00:00
325 Etc/GMT-2 +02 +02 +02:00:00 +00:00:00 +00:00:00
326 Etc/GMT+3 -03 -03 -03:00:00 +00:00:00 +00:00:00
327 Etc/GMT-3 +03 +03 +03:00:00 +00:00:00 +00:00:00
328 Etc/GMT+4 -04 -04 -04:00:00 +00:00:00 +00:00:00
329 Etc/GMT-4 +04 +04 +04:00:00 +00:00:00 +00:00:00
330 Etc/GMT+5 -05 -05 -05:00:00 +00:00:00 +00:00:00
331 Etc/GMT-5 +05 +05 +05:00:00 +00:00:00 +00:00:00
332 Etc/GMT+6 -06 -06 -06:00:00 +00:00:00 +00:00:00
333 Etc/GMT-6 +06 +06 +06:00:00 +00:00:00 +00:00:00
334 Etc/GMT+7 -07 -07 -07:00:00 +00:00:00 +00:00:00
335 Etc/GMT-7 +07 +07 +07:00:00 +00:00:00 +00:00:00
336 Etc/GMT+8 -08 -08 -08:00:00 +00:00:00 +00:00:00
337 Etc/GMT-8 +08 +08 +08:00:00 +00:00:00 +00:00:00
338 Etc/GMT+9 -09 -09 -09:00:00 +00:00:00 +00:00:00
339 Etc/GMT-9 +09 +09 +09:00:00 +00:00:00 +00:00:00
340 Etc/UTC UTC UTC +00:00:00 +00:00:00 +00:00:00
341 Europe/Amsterdam CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
342 Europe/Andorra CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
343 Europe/Astrakhan +04 +04 +04:00:00 +00:00:00 +00:00:00
344 Europe/Athens EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
Europe/Belfast GMT GMT BST BST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
345 Europe/Belgrade CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
346 Europe/Berlin CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Bratislava CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
347 Europe/Brussels CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
348 Europe/Bucharest EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
349 Europe/Budapest CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
350 Europe/Chisinau EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +02:00:00
351 Europe/Copenhagen CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
352 Europe/Dublin GMT IST GMT IST IST GMT IST GMT +00:00:00 +01:00:00 +01:00:00 -01:00:00 -1;0;3 -1;0;10 +01:00:00 +02:00:00 -1;0;10 -1;0;3 +02:00:00 +01:00:00
353 Europe/Gibraltar CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
354 Europe/Guernsey GMT GMT BST BST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
355 Europe/Helsinki EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
356 Europe/Istanbul Europe/Isle_of_Man EET GMT EET GMT EEST BST EEST BST +02:00:00 +00:00:00 +01:00:00 -1;0;3 +03:00:00 +01:00:00 -1;0;10 +04:00:00 +02:00:00
357 Europe/Kaliningrad Europe/Istanbul EET +03 EET +03 EEST EEST +02:00:00 +03:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
358 Europe/Kiev Europe/Jersey EET GMT EET GMT EEST BST EEST BST +02:00:00 +00:00:00 +01:00:00 -1;0;3 +03:00:00 +01:00:00 -1;0;10 +04:00:00 +02:00:00
359 Europe/Kaliningrad EET EET +02:00:00 +00:00:00 +00:00:00
360 Europe/Kirov MSK MSK +03:00:00 +00:00:00 +00:00:00
361 Europe/Kyiv EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
362 Europe/Lisbon WET WET WEST WEST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
363 Europe/Ljubljana CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
364 Europe/London GMT GMT BST BST +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +02:00:00
365 Europe/Luxembourg CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
366 Europe/Madrid CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
367 Europe/Malta CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
368 Europe/Minsk EET +03 EET +03 EEST EEST +02:00:00 +03:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
369 Europe/Monaco CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
370 Europe/Moscow MSK MSK MSD MSD +03:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
Europe/Nicosia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
371 Europe/Oslo CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
372 Europe/Paris CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
373 Europe/Prague CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
374 Europe/Riga EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
375 Europe/Rome CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
376 Europe/Samara SAMT +04 SAMT +04 SAMST SAMST +04:00:00 +01:00:00 +00:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00 +00:00:00
Europe/San_Marino CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
377 Europe/Sarajevo CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
378 Europe/Simferopol Europe/Saratov EET +04 EET +04 EEST EEST +02:00:00 +04:00:00 +01:00:00 +00:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +00:00:00
379 Europe/Simferopol MSK MSK +03:00:00 +00:00:00 +00:00:00
380 Europe/Skopje CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
381 Europe/Sofia EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
382 Europe/Stockholm CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
383 Europe/Tallinn EET EET EEST EEST +02:00:00 +00:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +00:00:00 +04:00:00
384 Europe/Tirane CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
385 Europe/Uzhgorod Europe/Ulyanovsk EET +04 EET +04 EEST EEST +02:00:00 +04:00:00 +01:00:00 +00:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00 +00:00:00
386 Europe/Vaduz CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Vatican CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
387 Europe/Vienna CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
388 Europe/Vilnius EET EET EEST EEST +02:00:00 +00:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +00:00:00 +04:00:00
389 Europe/Volgograd MSK MSK +03:00:00 +00:00:00 +00:00:00
390 Europe/Warsaw CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
391 Europe/Zagreb CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
Europe/Zaporozhye EET EET EEST EEST +02:00:00 +01:00:00 -1;0;3 +03:00:00 -1;0;10 +04:00:00
392 Europe/Zurich CET CET CEST CEST +01:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +03:00:00
393 Factory -00 -00 +00:00:00 +00:00:00 +00:00:00
394 HST HST HST -10:00:00 +00:00:00 +00:00:00
395 Indian/Antananarivo EAT EAT +03:00:00 +00:00:00 +00:00:00
396 Indian/Chagos IOT +06 IOT +06 +06:00:00 +00:00:00 +00:00:00
397 Indian/Christmas CXT +07 CXT +07 +07:00:00 +00:00:00 +00:00:00
398 Indian/Cocos CCT +0630 CCT +0630 +06:30:00 +00:00:00 +00:00:00
399 Indian/Comoro EAT EAT +03:00:00 +00:00:00 +00:00:00
400 Indian/Kerguelen TFT +05 TFT +05 +05:00:00 +00:00:00 +00:00:00
401 Indian/Mahe SCT +04 SCT +04 +04:00:00 +00:00:00 +00:00:00
402 Indian/Maldives MVT +05 MVT +05 +05:00:00 +00:00:00 +00:00:00
403 Indian/Mauritius MUT +04 MUT +04 +04:00:00 +00:00:00 +00:00:00
404 Indian/Mayotte EAT EAT +03:00:00 +00:00:00 +00:00:00
405 Indian/Reunion RET +04 RET +04 +04:00:00 +00:00:00 +00:00:00
406 Pacific/Apia MET WST MET WST MET MEST MEST -11:00:00 +01:00:00 +00:00:00 +01:00:00 -1;0;3 +02:00:00 -1;0;10 +00:00:00 +03:00:00
407 Pacific/Auckland MST NZST MST NZST MST NZDT NZDT +12:00:00 -07:00:00 +01:00:00 +00:00:00 1;0;10 +02:00:00 3;0;3 +03:00:00 +00:00:00
408 Pacific/Chatham MST7MDT CHAST MST CHAST MST CHADT MDT CHADT MDT +12:45:00 -07:00:00 +01:00:00 1;0;10 2;0;3 +02:45:00 +02:00:00 3;0;3 1;0;11 +03:45:00 +02:00:00
409 Pacific/Easter Pacific/Apia EAST +13 EAST +13 EASST EASST -06:00:00 +13:00:00 +01:00:00 +00:00:00 2;6;10 +22:00:00 2;6;3 +22:00:00 +00:00:00
410 Pacific/Efate Pacific/Auckland VUT NZST VUT NZST NZDT NZDT +11:00:00 +12:00:00 +00:00:00 +01:00:00 -1;0;9 +02:00:00 1;0;4 +00:00:00 +03:00:00
411 Pacific/Enderbury Pacific/Bougainville PHOT +11 PHOT +11 +13:00:00 +11:00:00 +00:00:00 +00:00:00
412 Pacific/Fakaofo Pacific/Chatham TKT +1245 TKT +1245 +1345 +1345 -10:00:00 +12:45:00 +00:00:00 +01:00:00 -1;0;9 +02:45:00 1;0;4 +00:00:00 +03:45:00
413 Pacific/Fiji Pacific/Chuuk FJT +10 FJT +10 +12:00:00 +10:00:00 +00:00:00 +00:00:00
414 Pacific/Funafuti Pacific/Easter TVT -06 TVT -06 -05 -05 +12:00:00 -06:00:00 +00:00:00 +01:00:00 1;0;9 +21:00:00 1;0;4 +00:00:00 +23:00:00
415 Pacific/Galapagos Pacific/Efate GALT +11 GALT +11 -06:00:00 +11:00:00 +00:00:00 +00:00:00
416 Pacific/Gambier Pacific/Fakaofo GAMT +13 GAMT +13 -09:00:00 +13:00:00 +00:00:00 +00:00:00
417 Pacific/Guadalcanal Pacific/Fiji SBT +12 SBT +12 +11:00:00 +12:00:00 +00:00:00 +00:00:00
418 Pacific/Funafuti +12 +12 +12:00:00 +00:00:00 +00:00:00
419 Pacific/Galapagos -06 -06 -06:00:00 +00:00:00 +00:00:00
420 Pacific/Gambier -09 -09 -09:00:00 +00:00:00 +00:00:00
421 Pacific/Guadalcanal +11 +11 +11:00:00 +00:00:00 +00:00:00
422 Pacific/Guam ChST ChST +10:00:00 +00:00:00 +00:00:00
423 Pacific/Honolulu HST HST -10:00:00 +00:00:00 +00:00:00
424 Pacific/Johnston Pacific/Kanton HST +13 HST +13 -10:00:00 +13:00:00 +00:00:00 +00:00:00
425 Pacific/Kiritimati LINT +14 LINT +14 +14:00:00 +00:00:00 +00:00:00
426 Pacific/Kosrae KOST +11 KOST +11 +11:00:00 +00:00:00 +00:00:00
427 Pacific/Kwajalein MHT +12 MHT +12 +12:00:00 +00:00:00 +00:00:00
428 Pacific/Majuro MHT +12 MHT +12 +12:00:00 +00:00:00 +00:00:00
429 Pacific/Marquesas MART -0930 MART -0930 -09:30:00 +00:00:00 +00:00:00
430 Pacific/Midway SST SST -11:00:00 +00:00:00 +00:00:00
431 Pacific/Nauru NRT +12 NRT +12 +12:00:00 +00:00:00 +00:00:00
432 Pacific/Niue NUT -11 NUT -11 -11:00:00 +00:00:00 +00:00:00
433 Pacific/Norfolk NFT +11 NFT +11 +12 +12 +11:30:00 +11:00:00 +00:00:00 +01:00:00 1;0;10 +02:00:00 1;0;4 +00:00:00 +03:00:00
434 Pacific/Noumea NCT +11 NCT +11 +11:00:00 +00:00:00 +00:00:00
435 Pacific/Pago_Pago SST SST -11:00:00 +00:00:00 +00:00:00
436 Pacific/Palau PWT +09 PWT +09 +09:00:00 +00:00:00 +00:00:00
437 Pacific/Pitcairn PST -08 PST -08 -08:00:00 +00:00:00 +00:00:00
438 Pacific/Ponape Pacific/Pohnpei PONT +11 PONT +11 +11:00:00 +00:00:00 +00:00:00
439 Pacific/Port_Moresby PGT +10 PGT +10 +10:00:00 +00:00:00 +00:00:00
440 Pacific/Rarotonga CKT -10 CKT -10 -10:00:00 +00:00:00 +00:00:00
441 Pacific/Saipan ChST ChST +10:00:00 +00:00:00 +00:00:00
442 Pacific/Tahiti TAHT -10 TAHT -10 -10:00:00 +00:00:00 +00:00:00
443 Pacific/Tarawa GILT +12 GILT +12 +12:00:00 +00:00:00 +00:00:00
444 Pacific/Tongatapu TOT +13 TOT +13 +13:00:00 +00:00:00 +00:00:00
445 Pacific/Truk Pacific/Wake TRUT +12 TRUT +12 +10:00:00 +12:00:00 +00:00:00 +00:00:00
446 Pacific/Wake Pacific/Wallis WAKT +12 WAKT +12 +12:00:00 +00:00:00 +00:00:00
447 Pacific/Wallis PST8PDT WFT PST WFT PST PDT PDT +12:00:00 -08:00:00 +00:00:00 +01:00:00 2;0;3 +02:00:00 1;0;11 +00:00:00 +02:00:00
448 Pacific/Yap WET YAPT WET YAPT WET WEST WEST +10:00:00 +00:00:00 +00:00:00 +01:00:00 -1;0;3 +01:00:00 -1;0;10 +00:00:00 +02:00:00
Executable
+257
View File
@@ -0,0 +1,257 @@
#!/usr/bin/perl -w
# created based on tzdump.pl
use strict;
sub timeoffset
{
my $value = shift;
my $seconds = $value % 60;
my $minutes = ($value / 60) % 60;
my $hours = $value / 3600;
sprintf "%+03d:%02d:%02d",$hours,$minutes,$seconds;
}
# mtwtfss mtwtfss
sub timerule
{
my ($time,$isgmt,$offset) = @_;
# print "isgmt=$isgmt time=$time offset=$offset\n";
$time += $offset if(!$isgmt);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$foo) = gmtime($time);
++$mon;
my $nweek = int(($mday-1)/7) + 1;
$nweek = -1 if($nweek >= 4);
"$nweek;$wday;$mon";
}
sub dsttime
{
my ($time,$isstd,$offset1,$offset2) = @_;
# print "isstd=$isstd time=$time offset1=$offset1 offset2=$offset2\n";
$time += ($isstd ? $offset1 : $offset2);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$foo) = gmtime($time);
sprintf "%+03d:%02d:%02d",$hour,$min,$sec;
}
sub tzinfo
{
my $dir = "/usr/share/zoneinfo";
my $zone = shift;
if (not open (FILE, "$dir/$zone"))
{
warn "open $dir/$zone: $!\n";
return;
}
my $year = 1900 + (gmtime(time))[5];
my $tzfile = {};
my $data;
sysread (FILE, $data, 44) or die;
my ($header, $reserved, $ttisgmtcnt, $ttisstdcnt, $leapcnt, $timecnt,
$typecnt, $charcnt) = unpack "a4 a16 N N N N N N", $data;
if ($header ne "TZif")
{
warn "$dir/$zone: Doesn't look like tzfile data\n";
close FILE;
return;
}
# print "ttisgmtcnt=$ttisgmtcnt, ttisstdcnt=$ttisstdcnt, leapcnt=$leapcnt, timecnt=$timecnt, typecnt=$typecnt, charcnt=$charcnt\n";
my $tzdata;
my $index = 0;
sysread (FILE, $tzdata, 5 * $timecnt + 6 * $typecnt + $charcnt +
8 * $leapcnt + $ttisstdcnt + $ttisgmtcnt);
my $tzchunk = sub
{
my $howbig = shift;
my $chunk = substr ($tzdata, $index, $howbig);
$index += $howbig;
$chunk;
};
my %ttimes;
my @ttimes;
my @ttindexes;
my @dates; # settings for current year
my @indexes;
my $lastindex = -1;
if ($timecnt)
{
$data = &$tzchunk (4 * $timecnt);
@ttimes = unpack ("N" x $timecnt, $data);
$data = &$tzchunk ($timecnt);
@ttindexes = unpack "C" x $timecnt, $data;
for (my $i=0; $i<=$#ttimes; $i++)
{
my $ruleyear = 1900 + (gmtime($ttimes[$i]))[5];
$lastindex = $ttindexes[$i];
if ($ruleyear == $year)
{
push @dates, $ttimes[$i];
push @indexes, $ttindexes[$i];
}
}
}
my @ttinfo;
foreach (0 .. $typecnt - 1)
{
$data = &$tzchunk (6);
my ($gmtoff, $isdst, $abbrind) = unpack ("N c C", $data);
$gmtoff = unpack ("l", pack ("L", $gmtoff));
push (@ttinfo, { gmtoff => $gmtoff, isdst => $isdst, abbrind => $abbrind });
# print "ttinfo[$_]: gmtoff=$gmtoff isdst=$isdst abbrind=$abbrind\n";
}
my $tznames;
if ($charcnt)
{
$tznames = &$tzchunk ($charcnt) or die;
# print "abbrevs: ", join (", ", split /\000/, $tznames), "\n";
}
my @leapsecs;
if ($leapcnt)
{
$data = &$tzchunk (8 * $leapcnt);
# print "leapsecs: ", join (", ", unpack ("NN" x $leapcnt, $data)), "\n";
}
my @stddata;
if ($ttisstdcnt)
{
$data = &$tzchunk ($ttisstdcnt);
@stddata = unpack ("C" x $ttisstdcnt, $data);
# print "isstd: ", join (", ", @stddata), "\n";
}
my @gmtdata;
if ($ttisgmtcnt)
{
$data = &$tzchunk ($ttisgmtcnt);
@gmtdata = unpack ("C" x $ttisgmtcnt, $data);
# print "isgmt: ", join(", ", @gmtdata), "\n";
}
close FILE;
# Print Boost date_time_zoneinfo line
# for(my $i=0; $i<=$#dates; $i++)
# {
# print scalar gmtime ($dates[$i]), " => ", $indexes[$i], " ", $ttimes[$i], "\n";
# }
if ($#dates == 1)
{
# ID, STD ABBR, STD NAME, DST ABBR, DST NAME, GMT offset, DST adjustment, Rule1, Time1, Rule2, Time2
# "Europe/Helsinki","EET","EET","EEST","EEST","+02:00:00","+01:00:00","-1;0;3","+03:00:00","-1;0;10","+04:00:00"
# Rule = week,day,month
# week=1...5 or -1 if last week. We interpret week 4/5 to always imply last week
# day=0...6, 0=Sun
my $isdst1 = $ttinfo[$indexes[0]]{isdst};
my $isdst2 = $ttinfo[$indexes[1]]{isdst};
my $abbrind1 = $ttinfo[$indexes[0]]{abbrind};
my $abbrind2 = $ttinfo[$indexes[1]]{abbrind};
my $isgmt1 = $gmtdata[$indexes[0]];
my $isgmt2 = $gmtdata[$indexes[1]];
my $isstd1 = $stddata[$indexes[0]];
my $isstd2 = $stddata[$indexes[1]];
my $zname1 = substr($tznames,$abbrind1,index($tznames,"\000",$abbrind1)-$abbrind1);
my $zname2 = substr($tznames,$abbrind2,index($tznames,"\000",$abbrind2)-$abbrind2);
if($isdst1)
{
my $tmp = $zname1;
$zname1 = $zname2;
$zname2 = $tmp;
}
my $offset1 = $ttinfo[$indexes[0]]{gmtoff};
my $offset2 = $ttinfo[$indexes[1]]{gmtoff};
my $gmtoffset = ($isdst1 ? timeoffset($offset2) : timeoffset($offset1));
my $dstadjustment = timeoffset($isdst1 ? $offset1-$offset2 : $offset2-$offset1);
my $dststartrule = timerule($isdst1 ? $dates[0] : $dates[1], $isgmt1, $offset1);
my $dststarttime = ($isdst1 ? dsttime($dates[1],$isstd2,$offset2,$offset1) : dsttime($dates[0],$isstd1,$offset1,$offset2));
my $dstendrule = timerule($isdst1 ? $dates[1] : $dates[0], $isgmt2, $offset2);
my $dstendtime = ($isdst1 ? dsttime($dates[0],$isstd1,$offset1,$offset2) : dsttime($dates[1],$isstd2,$offset2,$offset1));
print "\"$zone\",\"$zname1\",\"$zname1\",\"$zname2\",\"$zname2\",\"$gmtoffset\",\"$dstadjustment\",\"$dststartrule\",\"$dststarttime\",\"$dstendrule\",\"$dstendtime\"\n";
}
else
{
# Use the last row if everything fails (Asia/Calcutta, Europe/Moscow)
if($lastindex < 0)
{
$lastindex = $#ttinfo;
}
# ID, STD ABBR, STD NAME, DST ABBR, DST NAME, GMT offset, DST adjustment, Rule1, Time1, Rule2, Time2
# "Europe/Moscow","MSK","MSK","","","+03:00:00","+00:00:00","","","","+00:00:00"
my $isdst = $ttinfo[$lastindex]{isdst};
my $abbrind = $ttinfo[$lastindex]{abbrind};
my $isgmt = $gmtdata[$lastindex];
my $isstd = $stddata[$lastindex];
my $zname = substr($tznames,$abbrind,index($tznames,"\000",$abbrind)-$abbrind);
my $offset = $ttinfo[$lastindex]{gmtoff};
my $gmtoffset = timeoffset($offset);
my $dstadjustment = "+00:00:00";
my $dststartrule = "";
my $dststarttime = "";
my $dstendrule = "";
my $dstendtime = "+00:00:00"; # no idea why the Boost.Date_time does this
# print "$gmtoffset $offset\n";
print "\"$zone\",\"$zname\",\"$zname\",\"\",\"\",\"$gmtoffset\",\"$dstadjustment\",\"$dststartrule\",\"$dststarttime\",\"$dstendrule\",\"$dstendtime\"\n";
}
}
foreach my $filename (@ARGV)
{
tzinfo ($filename);
}
+18
View File
@@ -0,0 +1,18 @@
# Copyright (c) 2016 Rene Rivera
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
###############################################################################
alias boostdoc
: ../xmldoc/date_time.xml
:
: <dependency>../xmldoc//date_time_autodoc <dependency>../xmldoc//gregorian_autodoc
<dependency>../xmldoc//posix_time_autodoc <dependency>../xmldoc//local_time_autodoc
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;
+32 -94
View File
@@ -1,109 +1,47 @@
subproject libs/date_time/example ;
project : requirements <library>/boost/date_time//boost_date_time ;
local DATE_TIME_PROPERTIES = <define>BOOST_DATE_TIME_STATIC_LINK ;
exe dates_as_strings : gregorian/dates_as_strings.cpp ;
exe days_alive : gregorian/days_alive.cpp ;
exe days_till_new_year : gregorian/days_till_new_year.cpp ;
exe days_between_new_years : gregorian/days_between_new_years.cpp ;
exe find_last_day_of_months : gregorian/find_last_day_of_months.cpp ;
exe month_add : gregorian/month_add.cpp ;
exe localization : gregorian/localization.cpp ;
exe print_holidays : gregorian/print_holidays.cpp ;
exe print_month : gregorian/print_month.cpp ;
exe period_calc : gregorian/period_calc.cpp ;
exe days_since_year_start : gregorian/days_since_year_start.cpp ;
exe dates_as_strings : <lib>../build/boost_date_time
gregorian/dates_as_strings.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe days_alive : <lib>../build/boost_date_time
gregorian/days_alive.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
exe local_utc_conversion : posix_time/local_utc_conversion.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe days_till_new_year : <lib>../build/boost_date_time
gregorian/days_till_new_year.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
exe print_hours : posix_time/print_hours.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe days_between_new_years : <lib>../build/boost_date_time
gregorian/days_between_new_years.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
exe time_math : posix_time/time_math.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe find_last_day_of_months : <lib>../build/boost_date_time
gregorian/find_last_day_of_months.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe time_periods : posix_time/time_periods.cpp
: <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe month_add : <lib>../build/boost_date_time
gregorian/month_add.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe localization : gregorian/localization.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe print_holidays : <lib>../build/boost_date_time
gregorian/print_holidays.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe print_month : <lib>../build/boost_date_time
gregorian/print_month.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe period_calc : <lib>../build/boost_date_time
gregorian/period_calc.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe days_since_year_start : <lib>../build/boost_date_time
gregorian/days_since_year_start.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe local_utc_conversion : <lib>../build/boost_date_time
posix_time/local_utc_conversion.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe print_hours : <lib>../build/boost_date_time
posix_time/print_hours.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe time_math : <lib>../build/boost_date_time
posix_time/time_math.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe time_periods : <lib>../build/boost_date_time
posix_time/time_periods.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES) <define>BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
;
exe simple_time_zone : <lib>../build/boost_date_time
local_time/simple_time_zone.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe calc_rules : <lib>../build/boost_date_time
local_time/calc_rules.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe seconds_since_epoch : <lib>../build/boost_date_time
local_time/seconds_since_epoch.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe flight : <lib>../build/boost_date_time
local_time/flight.cpp
: <include>$(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
;
exe io_tutorial : tutorial/io_tutorial.cpp
: <include>$(BOOST_ROOT)
;
exe simple_time_zone : local_time/simple_time_zone.cpp ;
exe calc_rules : local_time/calc_rules.cpp ;
exe seconds_since_epoch : local_time/seconds_since_epoch.cpp ;
exe flight : local_time/flight.cpp ;
exe io_tutorial : tutorial/io_tutorial.cpp ;
# Copyright (c) 2002-2005
# CrystalClear Software, Inc.
# Subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or
# Subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)
+1 -1
View File
@@ -25,7 +25,7 @@ main()
date d(from_simple_string(s));
std::cout << to_simple_string(d) << std::endl;
//Read ISO Standard(CCYYMMDD) and output ISO Extended
//Read ISO 8601 Standard(CCYYMMDD) and output ISO 8601 Extended
std::string ud("20011009"); //2001-Oct-09
date d1(from_undelimited_string(ud));
std::cout << to_iso_extended_string(d1) << std::endl;
+4 -3
View File
@@ -3,10 +3,11 @@
* New Years day of this year, and days until next New Years day.
*
* Expected results:
* Adding together both durations will produce 366 (365 in a leap year).
* Adding together both durations will produce 365 (366 in a leap year).
*/
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>
int
main()
@@ -25,7 +26,7 @@ main()
std::cout << "Days until next Jan 1: " << days_until_year_start.days()
<< std::endl;
return 0;
};
}
/* Copyright 2001-2004: CrystalClear Software, Inc
+2 -2
View File
@@ -1,6 +1,6 @@
#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>
int
main()
@@ -14,7 +14,7 @@ main()
std::cout << "Days since Jan 1: " << days_since_year_start.days()
<< std::endl;
return 0;
};
}
/* Copyright 2001-2004: CrystalClear Software, Inc
* http://www.crystalclearsoftware.com
+1 -1
View File
@@ -15,7 +15,7 @@ main()
std::cout << "Days till new year: " << dd.days() << std::endl;
return 0;
};
}
/* Copyright 2001-2004: CrystalClear Software, Inc
* http://www.crystalclearsoftware.com
@@ -15,7 +15,8 @@ main()
// get a month and a year from the user
try {
int y, m;
greg_year::value_type y;
greg_month::value_type m;
std::cout << " Enter Year(ex: 2002): ";
std::cin >> y;
year = greg_year(y);
@@ -23,11 +24,11 @@ main()
std::cin >> m;
month = greg_month(m);
}
catch(bad_year by) {
catch(const bad_year& by) {
std::cout << "Invalid Year Entered: " << by.what() << '\n'
<< "Using minimum values for month and year." << std::endl;
}
catch(bad_month bm) {
catch(const bad_month& bm) {
std::cout << "Invalid Month Entered" << bm.what() << '\n'
<< "Using minimum value for month. " << std::endl;
}
+1 -1
View File
@@ -83,7 +83,7 @@ int main()
us_facet->format("%m/%d/%Y");
std::cout << d1 << std::endl; // 10/01/2002
// English names, iso order (year-month-day), '-' separator
// English names, ISO 8601 order (year-month-day), '-' separator
us_facet->format("%Y-%b-%d");
std::cout << d1 << std::endl; // 2002-Oct-01
+11 -5
View File
@@ -17,7 +17,7 @@ main()
date d2 = d + months(1);
date d3 = d - months(1);
std::cout << "Today is: " << to_simple_string(d) << ".\n"
<< "One month from today will be: " << to_simple_string(d2)
<< "One month from today will be: " << to_simple_string(d2) << ".\n"
<< "One month ago was: " << to_simple_string(d3)
<< std::endl;
std::cout << "******** Warning read this ***********************\n";
@@ -31,14 +31,20 @@ main()
<< std::endl;
std::cout << "\nSo what does this mean? It means the result of adding months is order\n"
<< "dependent, non-communitive, and may create problems for applications.\n"
<< "dependent, non-commutative, and may create problems for applications.\n"
<< "Consider: \n"
<< "Jan 30, 2004 + (1 month) + (1 month) != Jan 29, 2004 + (2 months)\n"
<< "Why not? Because Jan 30, 2004 + 1 month is Feb 29 + 1 month is Mar 29th.\n"
<< "while Jan 30, 2004 + 2 months is Mar 29th.\n"
<< "Jan 30, 2004 + (1 month) + (1 month) != Jan 30, 2004 + (2 months)\n"
<< "Why not? Because Jan 30, 2004 + 1 month is Feb 29 + 1 month is Mar 31st.\n"
<< "while Jan 30, 2004 + 2 months is Mar 30th.\n"
<< "All of this clears up as long as all the starting dates before the 28th of\n"
<< "the month -- then all the behavior follows classical mathematical rules.\n";
date d6(2004, Jan, 30);
date d7 = d6 + months(1) + months(1);
date d8 = d6 + months(2);
std::cout << "2004-01-30 + (1 month) + (1 month) is: " << to_simple_string(d7) << ".\n"
<< "2004-01-30 + (2 months) is: " << to_simple_string(d8)
<< std::endl;
return 0;
}
+4 -4
View File
@@ -33,12 +33,12 @@ print_date(boost::gregorian::date d)
int
main() {
std::cout << "Enter Year: ";
int year;
std::cin >> year;
using namespace boost::gregorian;
std::cout << "Enter Year: ";
greg_year::value_type year;
std::cin >> year;
//define a collection of holidays fixed by month and day
std::vector<year_based_generator*> holidays;
holidays.push_back(new partial_date(1,Jan)); //Western New Year
+5 -3
View File
@@ -19,16 +19,18 @@
int
main()
{
using namespace boost::gregorian;
std::cout << "Enter Year: ";
int year, month;
greg_year::value_type year;
greg_month::value_type month;
std::cin >> year;
std::cout << "Enter Month(1..12): ";
std::cin >> month;
using namespace boost::gregorian;
try {
//Use the calendar to get the last day of the month
int eom_day = gregorian_calendar::end_of_month_day(year,month);
greg_day::value_type eom_day = gregorian_calendar::end_of_month_day(year,month);
date endOfMonth(year,month,eom_day);
//construct an iterator starting with firt day of the month
+19 -9
View File
@@ -5,7 +5,7 @@
/* This example shows a program that calculates the arrival time of a plane
* that flys from Phoenix to New York. During the flight New York shifts
* into daylight savings time (Phoenix doesn't because Arizona doesn't use
* dst).
* DST).
*
*
*/
@@ -20,24 +20,34 @@ int main()
//setup some timezones for creating and adjusting local times
//This user editable file can be found in libs/date_time/data.
tz_database tz_db;
tz_db.load_from_file("date_time_zonespec.csv");
try {
tz_db.load_from_file("../../data/date_time_zonespec.csv");
}catch(const data_not_accessible& dna) {
std::cerr << "Error with time zone data file: " << dna.what() << std::endl;
exit(EXIT_FAILURE);
}catch(const bad_field_count& bfc) {
std::cerr << "Error with time zone data file: " << bfc.what() << std::endl;
exit(EXIT_FAILURE);
}
time_zone_ptr nyc_tz = tz_db.time_zone_from_region("America/New_York");
//Use a
//Use a newly created time zone rule
time_zone_ptr phx_tz(new posix_time_zone("MST-07:00:00"));
//local departure time in phoenix is 11 pm on april 2 2005
// (ny changes to dst on apr 3 at 2 am)
local_date_time phx_departure(date(2005, Apr, 2), hours(23),
//local departure time in Phoenix is 11 pm on March 13 2010
// (NY changes to DST on March 14 at 2 am)
local_date_time phx_departure(date(2010, Mar, 13), hours(23),
phx_tz,
local_date_time::NOT_DATE_TIME_ON_ERROR);
local_date_time nyc_departure = phx_departure.local_time_in(nyc_tz);
time_duration flight_length = hours(4) + minutes(30);
local_date_time phx_arrival = phx_departure + flight_length;
local_date_time nyc_arrival = phx_arrival.local_time_in(nyc_tz);
std::cout << "departure phx time: " << phx_departure << std::endl;
std::cout << "arrival phx time: " << phx_arrival << std::endl;
std::cout << "arrival nyc time: " << nyc_arrival << std::endl;
std::cout << "departure PHX time: " << phx_departure << std::endl;
std::cout << "departure NYC time: " << nyc_departure << std::endl;
std::cout << "arrival PHX time: " << phx_arrival << std::endl;
std::cout << "arrival NYC time: " << nyc_arrival << std::endl;
}
+3 -3
View File
@@ -24,14 +24,14 @@ int main() {
local_date_time ny_time(date(2004, Aug, 30), hours(10), nyc, true);
typedef boost::date_time::time_facet<local_date_time, char> ldt_facet;
ldt_facet* timefacet = new ldt_facet("%Y-%b-%d %H:%M:%S%F %Z");
ldt_facet* timefacet = new ldt_facet("%Y-%b-%d %H:%M:%S""%F %Z");
std::locale loc(std::locale::classic(), timefacet);
std::cout << ny_time << std::endl;
// 2004-Aug-30 00:00:00 EDT
// 2004-Aug-30 10:00:00 EDT
std::cout.imbue(loc);
std::cout << ny_time << std::endl;
// 2004-Aug-30 00:00:00 Eastern Daylight Time
// 2004-Aug-30 10:00:00 Eastern Daylight Time
return 0;
}
+2 -2
View File
@@ -24,10 +24,10 @@ int main()
tz_database tz_db;
try {
tz_db.load_from_file("../data/date_time_zonespec.csv");
}catch(data_not_accessible dna) {
}catch(const data_not_accessible& dna) {
std::cerr << "Error with time zone data file: " << dna.what() << std::endl;
exit(EXIT_FAILURE);
}catch(bad_field_count bfc) {
}catch(const bad_field_count& bfc) {
std::cerr << "Error with time zone data file: " << bfc.what() << std::endl;
exit(EXIT_FAILURE);
}
+4 -4
View File
@@ -29,16 +29,16 @@ main()
ptime now = second_clock::local_time();
//Get the date part out of the time
date today = now.date();
date tommorrow = today + days(1);
ptime tommorrow_start(tommorrow); //midnight
date tomorrow = today + days(1);
ptime tomorrow_start(tomorrow); //midnight
//iterator adds by one hour
time_iterator titr(now,hours(1));
for (; titr < tommorrow_start; ++titr) {
for (; titr < tomorrow_start; ++titr) {
std::cout << to_simple_string(*titr) << std::endl;
}
time_duration remaining = tommorrow_start - now;
time_duration remaining = tomorrow_start - now;
std::cout << "Time left till midnight: "
<< to_simple_string(remaining) << std::endl;
return 0;
+1 -1
View File
@@ -13,7 +13,7 @@ main()
using namespace boost::gregorian;
date d(2002,Feb,1); //an arbitrary date
//construct a time by adding up some durations durations
//construct a time by adding up some durations
ptime t1(d, hours(5)+minutes(4)+seconds(2)+milliseconds(1));
//construct a new time by subtracting some times
ptime t2 = t1 - hours(5)- minutes(4)- seconds(2)- milliseconds(1);
+1 -1
View File
@@ -141,7 +141,7 @@ int main(){
period_formatter per_formatter(period_formatter::AS_OPEN_RANGE,
" to ", "from ", " exclusive", " inclusive" );
period_parser per_parser(period_parser::AS_OPEN_RANGE,
" to ", "from ", " exclusive" , "inclusive" );
" to ", "from ", " exclusive" , " inclusive" );
// default output
ss.str("");
+20 -34
View File
@@ -2,7 +2,7 @@
#define _DATE_TIME_ADJUST_FUNCTORS_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
@@ -14,26 +14,21 @@
namespace boost {
namespace date_time {
//! Functor to iterate a fixed number of days
template<class date_type>
class day_functor
class day_functor
{
public:
typedef typename date_type::duration_type duration_type;
day_functor(int f) : f_(f) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type&) const
{
// why is 'd' a parameter???
// fix compiler warnings
d.year();
return duration_type(f_);
}
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type&) const
{
// fix compiler warnings
d.year();
return duration_type(-f_);
}
private:
@@ -43,7 +38,7 @@ namespace date_time {
//! Provides calculation to find next nth month given a date
/*! This adjustment function provides the logic for 'month-based'
* advancement on a ymd based calendar. The policy it uses
* advancement on a ymd based calendar. The policy it uses
* to handle the non existant end of month days is to back
* up to the last day of the month. Also, if the starting
* date is the last day of a month, this functor will attempt
@@ -51,7 +46,7 @@ namespace date_time {
*/
template<class date_type>
class month_functor
class month_functor
{
public:
typedef typename date_type::duration_type duration_type;
@@ -60,7 +55,7 @@ namespace date_time {
typedef typename cal_type::day_type day_type;
month_functor(int f) : f_(f), origDayOfMonth_(0) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
ymd_type ymd(d.year_month_day());
if (origDayOfMonth_ == 0) {
@@ -71,11 +66,9 @@ namespace date_time {
}
}
typedef date_time::wrapping_int2<short,1,12> wrap_int2;
typedef typename wrap_int2::int_type int_type;
wrap_int2 wi(ymd.month);
//calc the year wrap around, add() returns 0 or 1 if wrapped
int_type year = wi.add(static_cast<int_type>(f_));
year = static_cast<int_type>(year + ymd.year); //calculate resulting year
const typename ymd_type::year_type year(static_cast<typename ymd_type::year_type::value_type>(ymd.year + wi.add(f_)));
// std::cout << "trace wi: " << wi.as_int() << std::endl;
// std::cout << "trace year: " << year << std::endl;
//find the last day for the new month
@@ -91,7 +84,7 @@ namespace date_time {
return date_type(year, wi.as_int(), dayOfMonth) - d;
}
//! Returns a negative duration_type
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
ymd_type ymd(d.year_month_day());
if (origDayOfMonth_ == 0) {
@@ -102,11 +95,9 @@ namespace date_time {
}
}
typedef date_time::wrapping_int2<short,1,12> wrap_int2;
typedef typename wrap_int2::int_type int_type;
wrap_int2 wi(ymd.month);
//calc the year wrap around, add() returns 0 or 1 if wrapped
int_type year = wi.subtract(static_cast<int_type>(f_));
year = static_cast<int_type>(year + ymd.year); //calculate resulting year
const typename ymd_type::year_type year(static_cast<typename ymd_type::year_type::value_type>(ymd.year + wi.subtract(f_)));
//find the last day for the new month
day_type resultingEndOfMonthDay(cal_type::end_of_month_day(year, wi.as_int()));
//original was the end of month -- force to last day of month
@@ -127,24 +118,19 @@ namespace date_time {
//! Functor to iterate a over weeks
template<class date_type>
class week_functor
class week_functor
{
public:
typedef typename date_type::duration_type duration_type;
typedef typename date_type::calendar_type calendar_type;
week_functor(int f) : f_(f) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type&) const
{
// why is 'd' a parameter???
// fix compiler warnings
d.year();
return duration_type(f_*calendar_type::days_in_week());
return duration_type(f_*static_cast<int>(calendar_type::days_in_week()));
}
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type&) const
{
// fix compiler warnings
d.year();
return duration_type(-f_*calendar_type::days_in_week());
return duration_type(-f_*static_cast<int>(calendar_type::days_in_week()));
}
private:
int f_;
@@ -152,17 +138,17 @@ namespace date_time {
//! Functor to iterate by a year adjusting for leap years
template<class date_type>
class year_functor
class year_functor
{
public:
//typedef typename date_type::year_type year_type;
typedef typename date_type::duration_type duration_type;
year_functor(int f) : _mf(f * 12) {}
duration_type get_offset(const date_type& d) const
duration_type get_offset(const date_type& d) const
{
return _mf.get_offset(d);
}
duration_type get_neg_offset(const date_type& d) const
duration_type get_neg_offset(const date_type& d) const
{
return _mf.get_neg_offset(d);
}
@@ -170,7 +156,7 @@ namespace date_time {
month_functor<date_type> _mf;
};
} }//namespace date_time
@@ -14,7 +14,10 @@
*/
#include <stdexcept>
#include "boost/date_time/c_time.hpp"
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
namespace boost {
namespace date_time {
@@ -35,14 +38,19 @@ namespace date_time {
date_type time_t_start_day(1970,1,1);
time_type time_t_start_time(time_t_start_day,time_duration_type(0,0,0));
if (t < time_t_start_time) {
throw std::out_of_range("Cannot convert dates prior to Jan 1, 1970");
boost::throw_exception(std::out_of_range("Cannot convert dates prior to Jan 1, 1970"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_t_start_time); // should never reach
}
date_duration_type dd = t.date() - time_t_start_day;
time_duration_type td = t.time_of_day();
std::time_t t2 = dd.days()*86400 + td.hours()*3600 + td.minutes()*60 + td.seconds();
uint64_t t2 = static_cast<uint64_t>(dd.days())*86400 +
static_cast<uint64_t>(td.hours())*3600 +
static_cast<uint64_t>(td.minutes())*60 +
td.seconds();
// detect y2038 issue and throw instead of proceed with bad time
std::time_t tv = boost::numeric_cast<std::time_t>(t2);
std::tm tms, *tms_ptr;
tms_ptr = c_time::localtime(&t2, &tms);
//tms_ptr = std::localtime(&t2);
tms_ptr = c_time::localtime(&tv, &tms);
date_type d(static_cast<unsigned short>(tms_ptr->tm_year + 1900),
static_cast<unsigned short>(tms_ptr->tm_mon + 1),
static_cast<unsigned short>(tms_ptr->tm_mday));
+54 -17
View File
@@ -2,10 +2,10 @@
#define DATE_TIME_C_TIME_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* Author: Jeff Garland, Bart Garst
* $Date$
*/
@@ -14,10 +14,13 @@
Provide workarounds related to the ctime header
*/
#include "boost/date_time/compiler_config.hpp"
#include <ctime>
//Work around libraries that don't put time_t and time in namespace std
#include <string> // to be able to convert from string literals to exceptions
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
//Work around libraries that don't put time_t and time in namespace std
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::time_t; using ::time; using ::localtime;
using ::tm; using ::gmtime; }
@@ -35,12 +38,17 @@ namespace std { using ::time_t; using ::time; using ::localtime;
namespace boost {
namespace date_time {
//! Provides a uniform interface to some 'ctime' functions
/*! Provides a uniform interface to some ctime functions and
* their '_r' counterparts. The '_r' functions require a pointer to a
* user created std::tm struct whereas the regular functions use a
* staticly created struct and return a pointer to that. These wrapper
* functions require the user to create a std::tm struct and send in a
* pointer to it. A pointer to the user created struct will be returned. */
/*! Provides a uniform interface to some ctime functions and
* their '_r' counterparts. The '_r' functions require a pointer to a
* user created std::tm struct whereas the regular functions use a
* staticly created struct and return a pointer to that. These wrapper
* functions require the user to create a std::tm struct and send in a
* pointer to it. This struct may be used to store the resulting time.
* The returned pointer may or may not point to this struct, however,
* it will point to the result of the corresponding function.
* All functions do proper checking of the C function results and throw
* exceptions on error. Therefore the functions will never return NULL.
*/
struct c_time {
public:
#if defined(BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS)
@@ -49,7 +57,17 @@ namespace date_time {
static std::tm* localtime(const std::time_t* t, std::tm* result)
{
// localtime_r() not in namespace std???
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
std::tm tmp;
if(!localtime_r(t,&tmp))
result = 0;
else
*result = tmp;
#else
result = localtime_r(t, result);
#endif
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to local time"));
return result;
}
//! requires a pointer to a user created std::tm struct
@@ -57,20 +75,35 @@ namespace date_time {
static std::tm* gmtime(const std::time_t* t, std::tm* result)
{
// gmtime_r() not in namespace std???
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
std::tm tmp;
if(!gmtime_r(t,&tmp))
result = 0;
else
*result = tmp;
#else
result = gmtime_r(t, result);
#endif
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
return result;
}
#else // BOOST_HAS_THREADS
#else // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(push) // preserve warning settings
#pragma warning(disable : 4996) // disable depricated localtime/gmtime warning on vc8
#endif // _MSC_VER >= 1400
#endif
//! requires a pointer to a user created std::tm struct
inline
static std::tm* localtime(const std::time_t* t, std::tm* result)
{
result = std::localtime(t);
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to local time"));
return result;
}
//! requires a pointer to a user created std::tm struct
@@ -78,14 +111,18 @@ namespace date_time {
static std::tm* gmtime(const std::time_t* t, std::tm* result)
{
result = std::gmtime(t);
if (!result)
boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time"));
return result;
}
#if (defined(_MSC_VER) && (_MSC_VER >= 1400))
#if defined(__clang__) // Clang has to be checked before MSVC
#pragma clang diagnostic pop
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400))
#pragma warning(pop) // restore warnings to previous state
#endif // _MSC_VER >= 1400
#endif
#endif // BOOST_HAS_THREADS
#endif // BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS
};
}} // namespaces
#endif // DATE_TIME_C_TIME_HPP___
+47 -59
View File
@@ -8,25 +8,14 @@
* $Date$
*/
#include "boost/detail/workaround.hpp"
// With boost release 1.33, date_time will be using a different,
// more flexible, IO system. This new system is not compatible with
// old compilers. The original date_time IO system remains for those
// compilers. They must define this macro to use the legacy IO.
// (defined(__BORLANDC__) && (__BORLANDC__ <= 0x0581) ) ) &&
#if( BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) \
|| BOOST_WORKAROUND( __GNUC__, < 3) \
|| (BOOST_WORKAROUND( _MSC_VER, <= 1300) ) \
) \
&& !defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
# define USE_DATE_TIME_PRE_1_33_FACET_IO
#endif
#include <cstdlib>
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
// This file performs some local compiler configurations
#include "boost/date_time/locale_config.hpp" //set up locale configurations
#include <boost/date_time/locale_config.hpp> //set up locale configurations
//Set up a configuration parameter for platforms that have
//GetTimeOfDay
@@ -39,17 +28,13 @@
// Include extensions to date_duration - comment out to remove this feature
#define BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
// these extensions are known to cause problems with gcc295
#if defined(__GNUC__) && (__GNUC__ < 3)
#undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES
#endif
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) ) )
#if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) )
#define BOOST_DATE_TIME_NO_MEMBER_INIT
#endif
// include these types before we try to re-define them
#include "boost/cstdint.hpp"
#include <boost/cstdint.hpp>
//Define INT64_C for compilers that don't have it
#if (!defined(INT64_C))
@@ -58,13 +43,13 @@
/* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_RW_LIB)
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_RW_LIB)
#define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR
#endif
// Borland v5.64 does not have the following in std namespace; v5.5.1 does
#if defined(__BORLANDC__) && defined(BOOST_BCB_WITH_STLPORT)
#if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_STLPORT)
#include <locale>
namespace std {
using stlport::tolower;
@@ -81,61 +66,59 @@ namespace std {
#if (((defined(__GNUC__) && (__GNUC__ < 3)) || \
(defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \
!defined(_STLP_OWN_IOSTREAMS) ) || \
BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) )
#define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
#endif
// The macro marks up places where compiler complains for missing return statement or
// uninitialized variables after calling to boost::throw_exception.
// BOOST_UNREACHABLE_RETURN doesn't work since even compilers that support
// unreachable statements detection emit such warnings.
#if defined(_MSC_VER)
// Use special MSVC extension to markup unreachable code
# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) __assume(false)
#elif !defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION)
// Call to a non-returning function should suppress the warning
# if defined(BOOST_NO_STDC_NAMESPACE)
namespace std {
using ::abort;
}
# endif // defined(BOOST_NO_STDC_NAMESPACE)
# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) std::abort()
#else
// For other poor compilers the specified expression is compiled. Usually, this would be a return statement.
# define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) x
#endif
/* The following handles the definition of the necessary macros
* for dll building on Win32 platforms.
*
* For code that will be placed in the date_time .dll,
* it must be properly prefixed with BOOST_DATE_TIME_DECL.
* The corresponding .cpp file must have BOOST_DATE_TIME_SOURCES
* The corresponding .cpp file must have BOOST_DATE_TIME_SOURCE
* defined before including its header. For examples see:
* greg_month.hpp & greg_month.cpp
*
*/
#ifdef BOOST_HAS_DECLSPEC // defined in config system
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
// if they want just this one to be dynamically liked:
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
// export if this is our own source, otherwise import:
# ifdef BOOST_DATE_TIME_SOURCE
# define BOOST_DATE_TIME_DECL __declspec(dllexport)
# else
# define BOOST_DATE_TIME_DECL __declspec(dllimport)
# endif // BOOST_DATE_TIME_SOURCE
# endif // DYN_LINK
#endif // BOOST_HAS_DECLSPEC
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
// export if this is our own source, otherwise import:
# ifdef BOOST_DATE_TIME_SOURCE
# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT
# else
# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT
# endif // BOOST_DATE_TIME_SOURCE
#endif // DYN_LINK
//
// if BOOST_WHATEVER_DECL isn't defined yet define it now:
#ifndef BOOST_DATE_TIME_DECL
# define BOOST_DATE_TIME_DECL
#endif
//
// Automatically link to the correct build variant where possible.
//
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_date_time
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK)
# define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#if defined(BOOST_HAS_THREADS)
# if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__)
@@ -145,5 +128,10 @@ namespace std {
# endif
#endif
#if defined(BOOST_NO_CXX11_NULLPTR)
# define BOOST_DATE_TIME_NULLPTR 0
#else
# define BOOST_DATE_TIME_NULLPTR nullptr
#endif
#endif
+46 -15
View File
@@ -9,7 +9,12 @@
* $Date$
*/
#include <exception>
#include <stdexcept>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_base_of.hpp>
namespace boost {
@@ -34,29 +39,33 @@ namespace CV {
*
*/
template<class value_policies>
class constrained_value {
class BOOST_SYMBOL_VISIBLE constrained_value {
public:
typedef typename value_policies::value_type value_type;
// typedef except_type exception_type;
constrained_value(value_type value)
BOOST_CXX14_CONSTEXPR constrained_value(value_type value) : value_((min)())
{
assign(value);
};
constrained_value& operator=(value_type v)
{
}
BOOST_CXX14_CONSTEXPR constrained_value& operator=(value_type v)
{
assign(v);
return *this;
}
}
//! Return the max allowed value (traits method)
static value_type max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();};
static BOOST_CONSTEXPR value_type
max BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::max)();}
//! Return the min allowed value (traits method)
static value_type min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();};
static BOOST_CONSTEXPR value_type
min BOOST_PREVENT_MACRO_SUBSTITUTION () {return (value_policies::min)();}
//! Coerce into the representation type
operator value_type() const {return value_;};
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
protected:
value_type value_;
private:
void assign(value_type value)
BOOST_CXX14_CONSTEXPR void assign(value_type value)
{
//adding 1 below gets rid of a compiler warning which occurs when the
//min_value is 0 and the type is unsigned....
@@ -69,22 +78,44 @@ namespace CV {
return;
}
value_ = value;
}
};
//! Template to shortcut the constrained_value policy creation process
template<typename rep_type, rep_type min_value,
rep_type max_value, class exception_type>
class simple_exception_policy
class BOOST_SYMBOL_VISIBLE simple_exception_policy
{
struct BOOST_SYMBOL_VISIBLE exception_wrapper : public exception_type
{
// In order to support throw_exception mechanism in the BOOST_NO_EXCEPTIONS mode,
// we'll have to provide a way to acquire std::exception from the exception being thrown.
// However, we cannot derive from it, since it would make it interceptable by this class,
// which might not be what the user wanted.
operator std::out_of_range () const
{
// TODO: Make the message more descriptive by using arguments to on_error
return std::out_of_range("constrained value boundary has been violated");
}
};
typedef typename conditional<
is_base_of< std::exception, exception_type >::value,
exception_type,
exception_wrapper
>::type actual_exception_type;
public:
typedef rep_type value_type;
static rep_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; };
static rep_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value;};
static BOOST_CONSTEXPR rep_type
min BOOST_PREVENT_MACRO_SUBSTITUTION () { return min_value; }
static BOOST_CONSTEXPR rep_type
max BOOST_PREVENT_MACRO_SUBSTITUTION () { return max_value; }
static void on_error(rep_type, rep_type, violation_enum)
{
throw exception_type();
boost::throw_exception(actual_exception_type());
}
};
+67 -55
View File
@@ -2,43 +2,44 @@
#define DATE_TIME_DATE_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/year_month_day.hpp"
#include "boost/date_time/special_defs.hpp"
#include "boost/operators.hpp"
#include <boost/operators.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/year_month_day.hpp>
#include <boost/date_time/special_defs.hpp>
namespace boost {
namespace date_time {
//!Representation of timepoint at the one day level resolution.
/*!
/*!
The date template represents an interface shell for a date class
that is based on a year-month-day system such as the gregorian
or iso systems. It provides basic operations to enable calculation
and comparisons.
or ISO 8601 systems. It provides basic operations to enable calculation
and comparisons.
<b>Theory</b>
This date representation fundamentally departs from the C tm struct
This date representation fundamentally departs from the C tm struct
approach. The goal for this type is to provide efficient date
operations (add, subtract) and storage (minimize space to represent)
in a concrete class. Thus, the date uses a count internally to
represent a particular date. The calendar parameter defines
represent a particular date. The calendar parameter defines
the policies for converting the the year-month-day and internal
counted form here. Applications that need to perform heavy
formatting of the same date repeatedly will perform better
by using the year-month-day representation.
Internally the date uses a day number to represent the date.
This is a monotonic time representation. This representation
This is a monotonic time representation. This representation
allows for fast comparison as well as simplifying
the creation of writing numeric operations. Essentially, the
the creation of writing numeric operations. Essentially, the
internal day number is like adjusted julian day. The adjustment
is determined by the Epoch date which is represented as day 1 of
the calendar. Day 0 is reserved for negative infinity so that
@@ -48,11 +49,11 @@ namespace date_time {
day representations.
*/
template<class T, class calendar, class duration_type_>
class date : private
boost::less_than_comparable<T
, boost::equality_comparable<T
template<class T, class calendar, class duration_type_>
class BOOST_SYMBOL_VISIBLE date : private
boost::less_than_comparable<T
, boost::equality_comparable<T
> >
{
public:
@@ -67,128 +68,139 @@ namespace date_time {
typedef typename calendar::date_rep_type date_rep_type;
typedef typename calendar::date_int_type date_int_type;
typedef typename calendar::day_of_week_type day_of_week_type;
date(year_type y, month_type m, day_type d)
BOOST_CXX14_CONSTEXPR date(year_type y, month_type m, day_type d)
: days_(calendar::day_number(ymd_type(y, m, d)))
{}
date(const ymd_type& ymd)
BOOST_CXX14_CONSTEXPR date(const ymd_type& ymd)
: days_(calendar::day_number(ymd))
{}
{}
//let the compiler write copy, assignment, and destructor
year_type year() const
BOOST_CXX14_CONSTEXPR year_type year() const
{
ymd_type ymd = calendar::from_day_number(days_);
ymd_type ymd = calendar::from_day_number(days_);
return ymd.year;
}
month_type month() const
BOOST_CXX14_CONSTEXPR month_type month() const
{
ymd_type ymd = calendar::from_day_number(days_);
ymd_type ymd = calendar::from_day_number(days_);
return ymd.month;
}
day_type day() const
BOOST_CXX14_CONSTEXPR day_type day() const
{
ymd_type ymd = calendar::from_day_number(days_);
ymd_type ymd = calendar::from_day_number(days_);
return ymd.day;
}
day_of_week_type day_of_week() const
BOOST_CXX14_CONSTEXPR day_of_week_type day_of_week() const
{
ymd_type ymd = calendar::from_day_number(days_);
return calendar::day_of_week(ymd);
}
ymd_type year_month_day() const
BOOST_CXX14_CONSTEXPR ymd_type year_month_day() const
{
return calendar::from_day_number(days_);
}
bool operator<(const date_type& rhs) const
BOOST_CONSTEXPR bool operator<(const date_type& rhs) const
{
return days_ < rhs.days_;
}
bool operator==(const date_type& rhs) const
BOOST_CONSTEXPR bool operator==(const date_type& rhs) const
{
return days_ == rhs.days_;
}
//! check to see if date is a special value
bool is_special()const
BOOST_CONSTEXPR bool is_special()const
{
return(is_not_a_date() || is_infinity());
}
//! check to see if date is not a value
bool is_not_a_date() const
BOOST_CONSTEXPR bool is_not_a_date() const
{
return traits_type::is_not_a_number(days_);
}
//! check to see if date is one of the infinity values
bool is_infinity() const
BOOST_CONSTEXPR bool is_infinity() const
{
return traits_type::is_inf(days_);
}
//! check to see if date is greater than all possible dates
bool is_pos_infinity() const
BOOST_CONSTEXPR bool is_pos_infinity() const
{
return traits_type::is_pos_inf(days_);
}
//! check to see if date is greater than all possible dates
bool is_neg_infinity() const
BOOST_CONSTEXPR bool is_neg_infinity() const
{
return traits_type::is_neg_inf(days_);
}
//! return as a special value or a not_special if a normal date
special_values as_special() const
BOOST_CXX14_CONSTEXPR special_values as_special() const
{
return traits_type::to_special(days_);
}
duration_type operator-(const date_type& d) const
BOOST_CXX14_CONSTEXPR duration_type operator-(const date_type& d) const
{
date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_);
return duration_type(val.as_number());
if (!this->is_special() && !d.is_special())
{
// The duration underlying type may be wider than the date underlying type.
// Thus we calculate the difference in terms of two durations from some common fixed base date.
typedef typename duration_type::duration_rep_type duration_rep_type;
return duration_type(static_cast< duration_rep_type >(days_) - static_cast< duration_rep_type >(d.days_));
}
else
{
// In this case the difference will be a special value, too
date_rep_type val = date_rep_type(days_) - date_rep_type(d.days_);
return duration_type(val.as_special());
}
}
date_type operator-(const duration_type& dd) const
BOOST_CXX14_CONSTEXPR date_type operator-(const duration_type& dd) const
{
if(dd.is_special())
{
return date_type(date_rep_type(days_) - dd.get_rep());
}
return date_type(date_rep_type(days_) - dd.days());
return date_type(date_rep_type(days_) - static_cast<date_int_type>(dd.days()));
}
date_type operator-=(const duration_type& dd)
BOOST_CXX14_CONSTEXPR date_type operator-=(const duration_type& dd)
{
*this = *this - dd;
return date_type(days_);
}
date_rep_type day_count() const
BOOST_CONSTEXPR date_rep_type day_count() const
{
return days_;
};
}
//allow internal access from operators
date_type operator+(const duration_type& dd) const
BOOST_CXX14_CONSTEXPR date_type operator+(const duration_type& dd) const
{
if(dd.is_special())
{
return date_type(date_rep_type(days_) + dd.get_rep());
}
return date_type(date_rep_type(days_) + dd.days());
return date_type(date_rep_type(days_) + static_cast<date_int_type>(dd.days()));
}
date_type operator+=(const duration_type& dd)
BOOST_CXX14_CONSTEXPR date_type operator+=(const duration_type& dd)
{
*this = *this + dd;
*this = *this + dd;
return date_type(days_);
}
//see reference
protected:
/*! This is a private constructor which allows for the creation of new
dates. It is not exposed to users since that would require class
/*! This is a private constructor which allows for the creation of new
dates. It is not exposed to users since that would require class
users to understand the inner workings of the date class.
*/
explicit date(date_int_type days) : days_(days) {};
explicit date(date_rep_type days) : days_(days.as_number()) {};
BOOST_CONSTEXPR explicit date(date_int_type days) : days_(days) {}
BOOST_CXX14_CONSTEXPR explicit date(date_rep_type days) : days_(days.as_number()) {}
date_int_type days_;
};
} } // namespace date_time
@@ -36,18 +36,18 @@ namespace date_time {
{
::std::tm result;
::std::tm* curr = get_local_time(result);
return ymd_type(curr->tm_year + 1900,
curr->tm_mon + 1,
curr->tm_mday);
return ymd_type(static_cast<unsigned short>(curr->tm_year + 1900),
static_cast<unsigned short>(curr->tm_mon + 1),
static_cast<unsigned short>(curr->tm_mday));
}
//! Get the current day in universal date as a ymd_type
static typename date_type::ymd_type universal_day_ymd()
{
::std::tm result;
::std::tm* curr = get_universal_time(result);
return ymd_type(curr->tm_year + 1900,
curr->tm_mon + 1,
curr->tm_mday);
return ymd_type(static_cast<unsigned short>(curr->tm_year + 1900),
static_cast<unsigned short>(curr->tm_mon + 1),
static_cast<unsigned short>(curr->tm_mday));
}
//! Get the UTC day as a date type
static date_type universal_day()
+37 -38
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_DATE_DURATION__
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
@@ -11,6 +11,9 @@
#include <boost/operators.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/int_adapter.hpp>
namespace boost {
namespace date_time {
@@ -18,58 +21,57 @@ namespace date_time {
//! Duration type with date level resolution
template<class duration_rep_traits>
class date_duration : private
boost::less_than_comparable<date_duration< duration_rep_traits>
, boost::equality_comparable< date_duration< duration_rep_traits>
, boost::addable< date_duration< duration_rep_traits>
, boost::subtractable< date_duration< duration_rep_traits>
> > > >
{
class BOOST_SYMBOL_VISIBLE date_duration : private
boost::less_than_comparable1< date_duration< duration_rep_traits >
, boost::equality_comparable1< date_duration< duration_rep_traits >
, boost::addable1< date_duration< duration_rep_traits >
, boost::subtractable1< date_duration< duration_rep_traits >
, boost::dividable2< date_duration< duration_rep_traits >, int
> > > > >
{
public:
typedef typename duration_rep_traits::int_type duration_rep_type;
typedef typename duration_rep_traits::impl_type duration_rep;
//! Construct from a day count
explicit date_duration(duration_rep day_count) : days_(day_count) {};
BOOST_CXX14_CONSTEXPR explicit date_duration(duration_rep day_count) : days_(day_count) {}
/*! construct from special_values - only works when
* instantiated with duration_traits_adapted */
date_duration(special_values sv) :
BOOST_CXX14_CONSTEXPR date_duration(special_values sv) :
days_(duration_rep::from_special(sv))
{}
// copy constructor required for addable<> & subtractable<>
//! Construct from another date_duration (Copy Constructor)
date_duration(const date_duration<duration_rep_traits>& other) :
days_(other.days_)
{}
//! returns days_ as it's instantiated type - used for streaming
duration_rep get_rep()const
BOOST_CXX14_CONSTEXPR duration_rep get_rep()const
{
return days_;
}
bool is_special()const
BOOST_CXX14_CONSTEXPR special_values as_special() const
{
return days_.as_special();
}
BOOST_CXX14_CONSTEXPR bool is_special()const
{
return days_.is_special();
}
//! returns days as value, not object.
duration_rep_type days() const
BOOST_CXX14_CONSTEXPR duration_rep_type days() const
{
return duration_rep_traits::as_number(days_);
}
//! Returns the smallest duration -- used by to calculate 'end'
static date_duration unit()
static BOOST_CXX14_CONSTEXPR date_duration unit()
{
return date_duration<duration_rep_traits>(1);
}
//! Equality
bool operator==(const date_duration& rhs) const
BOOST_CXX14_CONSTEXPR bool operator==(const date_duration& rhs) const
{
return days_ == rhs.days_;
}
//! Less
bool operator<(const date_duration& rhs) const
BOOST_CXX14_CONSTEXPR bool operator<(const date_duration& rhs) const
{
return days_ < rhs.days_;
}
@@ -80,40 +82,37 @@ namespace date_time {
* so this will not compile */
//! Subtract another duration -- result is signed
date_duration operator-=(const date_duration& rhs)
BOOST_CXX14_CONSTEXPR date_duration& operator-=(const date_duration& rhs)
{
//days_ -= rhs.days_;
days_ = days_ - rhs.days_;
return *this;
}
//! Add a duration -- result is signed
date_duration operator+=(const date_duration& rhs)
BOOST_CXX14_CONSTEXPR date_duration& operator+=(const date_duration& rhs)
{
days_ = days_ + rhs.days_;
return *this;
}
//! unary- Allows for dd = -date_duration(2); -> dd == -2
date_duration operator-()const
BOOST_CXX14_CONSTEXPR date_duration operator-() const
{
return date_duration<duration_rep_traits>(get_rep() * (-1));
}
//! Division operations on a duration with an integer.
date_duration<duration_rep_traits> operator/=(int divisor)
BOOST_CXX14_CONSTEXPR date_duration& operator/=(int divisor)
{
days_ = days_ / divisor;
return *this;
}
date_duration<duration_rep_traits> operator/(int divisor)
{
return date_duration<duration_rep_traits>(days_ / divisor);
}
//! return sign information
bool is_negative() const
BOOST_CXX14_CONSTEXPR bool is_negative() const
{
return days_ < 0;
}
private:
duration_rep days_;
};
@@ -122,23 +121,23 @@ namespace date_time {
/*! Struct for instantiating date_duration with <b>NO</b> special values
* functionality. Allows for transparent implementation of either
* date_duration<long> or date_duration<int_adapter<long> > */
struct duration_traits_long
struct BOOST_SYMBOL_VISIBLE duration_traits_long
{
typedef long int_type;
typedef long impl_type;
static int_type as_number(impl_type i) { return i; };
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i) { return i; }
};
/*! Struct for instantiating date_duration <b>WITH</b> special values
* functionality. Allows for transparent implementation of either
* date_duration<long> or date_duration<int_adapter<long> > */
struct duration_traits_adapted
struct BOOST_SYMBOL_VISIBLE duration_traits_adapted
{
typedef long int_type;
typedef boost::date_time::int_adapter<long> impl_type;
static int_type as_number(impl_type i) { return i.as_number(); };
static BOOST_CXX14_CONSTEXPR int_type as_number(impl_type i) { return i.as_number(); }
};
} } //namspace date_time
+50 -54
View File
@@ -8,7 +8,8 @@
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/date_duration.hpp>
@@ -19,17 +20,17 @@ namespace date_time {
//! Additional duration type that represents a number of n*7 days
template <class duration_config>
class weeks_duration : public date_duration<duration_config> {
class BOOST_SYMBOL_VISIBLE weeks_duration : public date_duration<duration_config> {
public:
weeks_duration(typename duration_config::impl_type w)
BOOST_CXX14_CONSTEXPR weeks_duration(typename duration_config::impl_type w)
: date_duration<duration_config>(w * 7) {}
weeks_duration(special_values sv)
BOOST_CXX14_CONSTEXPR weeks_duration(special_values sv)
: date_duration<duration_config>(sv) {}
};
// predeclare
template<class t>
class years_duration;
class BOOST_SYMBOL_VISIBLE years_duration;
//! additional duration type that represents a logical month
/*! A logical month enables things like: "date(2002,Mar,2) + months(2) ->
@@ -37,7 +38,7 @@ namespace date_time {
* also be a last-day-of-the-month.
*/
template<class base_config>
class months_duration
class BOOST_SYMBOL_VISIBLE months_duration
{
private:
typedef typename base_config::int_rep int_rep;
@@ -48,106 +49,104 @@ namespace date_time {
typedef months_duration<base_config> months_type;
typedef years_duration<base_config> years_type;
public:
months_duration(int_rep num) : _m(num) {}
months_duration(special_values sv) : _m(sv)
BOOST_CXX14_CONSTEXPR months_duration(int_rep num) : _m(num) {}
BOOST_CXX14_CONSTEXPR months_duration(special_values sv) : _m(sv)
{
_m = int_rep::from_special(sv);
}
int_rep number_of_months() const { return _m; }
//! returns a negative duration
duration_type get_neg_offset(const date_type& d) const
BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_neg_offset(d));
}
duration_type get_offset(const date_type& d) const
BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_m.as_number());
return duration_type(m_adj.get_offset(d));
}
bool operator==(const months_type& rhs) const
BOOST_CONSTEXPR bool operator==(const months_type& rhs) const
{
return(_m == rhs._m);
}
bool operator!=(const months_type& rhs) const
BOOST_CONSTEXPR bool operator!=(const months_type& rhs) const
{
return(_m != rhs._m);
}
months_type operator+(const months_type& rhs)const
BOOST_CXX14_CONSTEXPR months_type operator+(const months_type& rhs)const
{
return months_type(_m + rhs._m);
}
months_type& operator+=(const months_type& rhs)
BOOST_CXX14_CONSTEXPR months_type& operator+=(const months_type& rhs)
{
_m = _m + rhs._m;
return *this;
}
months_type operator-(const months_type& rhs)const
BOOST_CXX14_CONSTEXPR months_type operator-(const months_type& rhs)const
{
return months_type(_m - rhs._m);
}
months_type& operator-=(const months_type& rhs)
BOOST_CXX14_CONSTEXPR months_type& operator-=(const months_type& rhs)
{
_m = _m - rhs._m;
return *this;
}
months_type operator*(const int_type rhs)const
BOOST_CXX14_CONSTEXPR months_type operator*(const int_type rhs)const
{
return months_type(_m * rhs);
}
months_type& operator*=(const int_type rhs)
BOOST_CXX14_CONSTEXPR months_type& operator*=(const int_type rhs)
{
_m = _m * rhs;
return *this;
}
months_type operator/(const int_type rhs)const
BOOST_CXX14_CONSTEXPR months_type operator/(const int_type rhs)const
{
return months_type(_m / rhs);
}
months_type& operator/=(const int_type rhs)
BOOST_CXX14_CONSTEXPR months_type& operator/=(const int_type rhs)
{
_m = _m / rhs;
return *this;
}
months_type operator+(const years_type& y)const
BOOST_CXX14_CONSTEXPR months_type operator+(const years_type& y)const
{
return months_type(y.number_of_years() * 12 + _m);
}
months_type& operator+=(const years_type& y)
BOOST_CXX14_CONSTEXPR months_type& operator+=(const years_type& y)
{
_m = y.number_of_years() * 12 + _m;
return *this;
}
months_type operator-(const years_type& y) const
BOOST_CXX14_CONSTEXPR months_type operator-(const years_type& y) const
{
return months_type(_m - y.number_of_years() * 12);
}
months_type& operator-=(const years_type& y)
BOOST_CXX14_CONSTEXPR months_type& operator-=(const years_type& y)
{
_m = _m - y.number_of_years() * 12;
return *this;
}
//
friend date_type operator+(const date_type& d, const months_type& m)
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const months_type& m)
{
return d + m.get_offset(d);
}
friend date_type operator+=(date_type& d, const months_type& m)
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const months_type& m)
{
return d += m.get_offset(d);
}
friend date_type operator-(const date_type& d, const months_type& m)
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d + m.get_neg_offset(d);
}
friend date_type operator-=(date_type& d, const months_type& m)
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const months_type& m)
{
// get_neg_offset returns a negative duration, so we add
return d += m.get_neg_offset(d);
}
private:
int_rep _m;
};
@@ -159,7 +158,7 @@ namespace date_time {
* 2004-Feb-29).
*/
template<class base_config>
class years_duration
class BOOST_SYMBOL_VISIBLE years_duration
{
private:
typedef typename base_config::int_rep int_rep;
@@ -170,24 +169,24 @@ namespace date_time {
typedef years_duration<base_config> years_type;
typedef months_duration<base_config> months_type;
public:
years_duration(int_rep num) : _y(num) {}
years_duration(special_values sv) : _y(sv)
BOOST_CXX14_CONSTEXPR years_duration(int_rep num) : _y(num) {}
BOOST_CXX14_CONSTEXPR years_duration(special_values sv) : _y(sv)
{
_y = int_rep::from_special(sv);
}
int_rep number_of_years() const { return _y; }
BOOST_CXX14_CONSTEXPR int_rep number_of_years() const { return _y; }
//! returns a negative duration
duration_type get_neg_offset(const date_type& d) const
BOOST_CXX14_CONSTEXPR duration_type get_neg_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_neg_offset(d));
}
duration_type get_offset(const date_type& d) const
BOOST_CXX14_CONSTEXPR duration_type get_offset(const date_type& d) const
{
month_adjustor_type m_adj(_y.as_number() * 12);
return duration_type(m_adj.get_offset(d));
}
bool operator==(const years_type& rhs) const
BOOST_CXX14_CONSTEXPR bool operator==(const years_type& rhs) const
{
return(_y == rhs._y);
}
@@ -195,75 +194,72 @@ namespace date_time {
{
return(_y != rhs._y);
}
years_type operator+(const years_type& rhs)const
BOOST_CXX14_CONSTEXPR years_type operator+(const years_type& rhs)const
{
return years_type(_y + rhs._y);
}
years_type& operator+=(const years_type& rhs)
BOOST_CXX14_CONSTEXPR years_type& operator+=(const years_type& rhs)
{
_y = _y + rhs._y;
return *this;
}
years_type operator-(const years_type& rhs)const
BOOST_CXX14_CONSTEXPR years_type operator-(const years_type& rhs)const
{
return years_type(_y - rhs._y);
}
years_type& operator-=(const years_type& rhs)
BOOST_CXX14_CONSTEXPR years_type& operator-=(const years_type& rhs)
{
_y = _y - rhs._y;
return *this;
}
years_type operator*(const int_type rhs)const
BOOST_CXX14_CONSTEXPR years_type operator*(const int_type rhs)const
{
return years_type(_y * rhs);
}
years_type& operator*=(const int_type rhs)
BOOST_CXX14_CONSTEXPR years_type& operator*=(const int_type rhs)
{
_y = _y * rhs;
return *this;
}
years_type operator/(const int_type rhs)const
BOOST_CXX14_CONSTEXPR years_type operator/(const int_type rhs)const
{
return years_type(_y / rhs);
}
years_type& operator/=(const int_type rhs)
BOOST_CXX14_CONSTEXPR years_type& operator/=(const int_type rhs)
{
_y = _y / rhs;
return *this;
}
months_type operator+(const months_type& m) const
BOOST_CXX14_CONSTEXPR months_type operator+(const months_type& m) const
{
return(months_type(_y * 12 + m.number_of_months()));
}
months_type operator-(const months_type& m) const
BOOST_CXX14_CONSTEXPR months_type operator-(const months_type& m) const
{
return(months_type(_y * 12 - m.number_of_months()));
}
//
friend date_type operator+(const date_type& d, const years_type& y)
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const years_type& y)
{
return d + y.get_offset(d);
}
friend date_type operator+=(date_type& d, const years_type& y)
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const years_type& y)
{
return d += y.get_offset(d);
}
friend date_type operator-(const date_type& d, const years_type& y)
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d + y.get_neg_offset(d);
}
friend date_type operator-=(date_type& d, const years_type& y)
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const years_type& y)
{
// get_neg_offset returns a negative duration, so we add
return d += y.get_neg_offset(d);
}
private:
int_rep _y;
};
}} // namespace boost::date_time
#endif // DATE_DURATION_TYPES_HPP___
+223 -232
View File
@@ -2,28 +2,32 @@
#define _DATE_TIME_DATE_FACET__HPP___
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Martin Andrian, Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/algorithm/string/replace.hpp"
#include "boost/date_time/period.hpp"
#include "boost/date_time/special_values_formatter.hpp"
#include "boost/date_time/period_formatter.hpp"
#include "boost/date_time/period_parser.hpp"
#include "boost/date_time/date_generator_formatter.hpp"
#include "boost/date_time/date_generator_parser.hpp"
#include "boost/date_time/format_date_parser.hpp"
#include <iterator> // ostreambuf_iterator
#include <locale>
#include <string>
#include <vector>
#include <boost/throw_exception.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/period.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/special_values_formatter.hpp>
#include <boost/date_time/period_formatter.hpp>
#include <boost/date_time/period_parser.hpp>
#include <boost/date_time/date_generator_formatter.hpp>
#include <boost/date_time/date_generator_parser.hpp>
#include <boost/date_time/format_date_parser.hpp>
namespace boost { namespace date_time {
/*! Class that provides format based I/O facet for date types.
*
* This class allows the formatting of dates by using format string.
@@ -40,9 +44,9 @@ namespace boost { namespace date_time {
* Default weekday format == %a
*/
template <class date_type,
class CharT,
class CharT,
class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class date_facet : public std::locale::facet {
class BOOST_SYMBOL_VISIBLE date_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
@@ -77,9 +81,9 @@ namespace boost { namespace date_time {
#if defined (__SUNPRO_CC) && defined (_RWSTD_VER)
std::locale::id& __get_id (void) const { return id; }
#endif
explicit date_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
explicit date_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
//m_format(standard_format_specifier)
m_format(default_date_format),
m_month_format(short_month_format),
@@ -88,22 +92,22 @@ namespace boost { namespace date_time {
explicit date_facet(const char_type* format_str,
const input_collection_type& short_names,
::size_t ref_count = 0)
: std::locale::facet(ref_count),
::size_t ref_count = 0)
: std::locale::facet(ref_count),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_month_short_names(short_names)
m_month_short_names(short_names)
{}
explicit date_facet(const char_type* format_str,
period_formatter_type per_formatter = period_formatter_type(),
explicit date_facet(const char_type* format_str,
period_formatter_type per_formatter = period_formatter_type(),
special_values_formatter_type sv_formatter = special_values_formatter_type(),
date_gen_formatter_type dg_formatter = date_gen_formatter_type(),
::size_t ref_count = 0)
: std::locale::facet(ref_count),
m_format(format_str),
: std::locale::facet(ref_count),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
m_period_formatter(per_formatter),
@@ -127,11 +131,11 @@ namespace boost { namespace date_time {
void weekday_format(const char_type* const format_str) {
m_weekday_format = format_str;
}
void period_formatter(period_formatter_type per_formatter) {
m_period_formatter= per_formatter;
}
void special_values_formatter(const special_values_formatter_type& svf)
void special_values_formatter(const special_values_formatter_type& svf)
{
m_special_values_formatter = svf;
}
@@ -160,24 +164,24 @@ namespace boost { namespace date_time {
m_date_gen_formatter.elements(new_strings, beg_pos);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const date_type& d) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const date_type& d) const
{
if (d.is_special()) {
if (d.is_special()) {
return do_put_special(next, a_ios, fill_char, d.as_special());
}
//The following line of code required the date to support a to_tm function
return do_put_tm(next, a_ios, fill_char, to_tm(d), m_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const duration_type& dd) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const duration_type& dd) const
{
if (dd.is_special()) {
if (dd.is_special()) {
return do_put_special(next, a_ios, fill_char, dd.get_rep().as_special());
}
@@ -195,164 +199,151 @@ namespace boost { namespace date_time {
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const month_type& m) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const month_type& m) const
{
//if (d.is_special()) {
//if (d.is_special()) {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
tm dtm;
init_tm(dtm);
dtm.tm_mon = m -1;
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_mon = m - 1;
return do_put_tm(next, a_ios, fill_char, dtm, m_month_format);
}
//! puts the day of month
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_type& day) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_type& day) const
{
tm dtm;
init_tm(dtm);
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_mday = day.as_number();
char_type tmp[3] = {'%','d'};
string_type temp_format(tmp);
return do_put_tm(next, a_ios, fill_char, dtm, temp_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_of_week_type& dow) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const day_of_week_type& dow) const
{
//if (d.is_special()) {
//if (d.is_special()) {
// return do_put_special(next, a_ios, fill_char, d.as_special());
//}
//The following line of code required the date to support a to_tm function
tm dtm;
init_tm(dtm);
std::tm dtm;
std::memset(&dtm, 0, sizeof(dtm));
dtm.tm_wday = dow;
return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const period_type& p) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const period_type& p) const
{
return m_period_formatter.put_period(next, a_ios, fill_char, p, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const partial_date_type& pd) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const partial_date_type& pd) const
{
return m_date_gen_formatter.put_partial_date(next, a_ios, fill_char, pd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const nth_kday_type& nkd) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const nth_kday_type& nkd) const
{
return m_date_gen_formatter.put_nth_kday(next, a_ios, fill_char, nkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const first_kday_type& fkd) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const first_kday_type& fkd) const
{
return m_date_gen_formatter.put_first_kday(next, a_ios, fill_char, fkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const last_kday_type& lkd) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const last_kday_type& lkd) const
{
return m_date_gen_formatter.put_last_kday(next, a_ios, fill_char, lkd, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_before_type& fkb) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_before_type& fkb) const
{
return m_date_gen_formatter.put_kday_before(next, a_ios, fill_char, fkb, *this);
}
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_after_type& fka) const
OutItrT put(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const kday_after_type& fka) const
{
return m_date_gen_formatter.put_kday_after(next, a_ios, fill_char, fka, *this);
}
protected:
//! Helper function to initialize all fields in a tm struct
tm init_tm(tm& tm_value) const
{
tm_value.tm_sec = 0; /* seconds */
tm_value.tm_min = 0; /* minutes */
tm_value.tm_hour = 0; /* hours */
tm_value.tm_mday = 0; /* day of the month */
tm_value.tm_mon = 0; /* month */
tm_value.tm_year = 0; /* year */
tm_value.tm_wday = 0; /* day of the week */
tm_value.tm_yday = 0; /* day in the year */
tm_value.tm_isdst = 0; /* daylight saving time */
return tm_value;
}
virtual OutItrT do_put_special(OutItrT next,
std::ios_base& /*a_ios*/,
char_type /*fill_char*/,
const boost::date_time::special_values sv) const
virtual OutItrT do_put_special(OutItrT next,
std::ios_base& /*a_ios*/,
char_type /*fill_char*/,
const boost::date_time::special_values sv) const
{
m_special_values_formatter.put_special(next, sv);
return next;
}
virtual OutItrT do_put_tm(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
virtual OutItrT do_put_tm(OutItrT next,
std::ios_base& a_ios,
char_type fill_char,
const tm& tm_value,
string_type a_format) const
string_type a_format) const
{
// update format string with custom names
if (m_weekday_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_weekday_format,
if (!m_weekday_long_names.empty()) {
boost::algorithm::replace_all(a_format,
long_weekday_format,
m_weekday_long_names[tm_value.tm_wday]);
}
if (m_weekday_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_weekday_format,
if (!m_weekday_short_names.empty()) {
boost::algorithm::replace_all(a_format,
short_weekday_format,
m_weekday_short_names[tm_value.tm_wday]);
}
if (m_month_long_names.size()) {
boost::algorithm::replace_all(a_format,
long_month_format,
if (!m_month_long_names.empty()) {
boost::algorithm::replace_all(a_format,
long_month_format,
m_month_long_names[tm_value.tm_mon]);
}
if (m_month_short_names.size()) {
boost::algorithm::replace_all(a_format,
short_month_format,
if (!m_month_short_names.empty()) {
boost::algorithm::replace_all(a_format,
short_month_format,
m_month_short_names[tm_value.tm_mon]);
}
// use time_put facet to create final string
return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios,
fill_char,
const char_type* p_format = a_format.c_str();
return std::use_facet<std::time_put<CharT> >(a_ios.getloc()).put(next, a_ios,
fill_char,
&tm_value,
&*a_format.begin(),
&*a_format.begin()+a_format.size());
p_format,
p_format + a_format.size());
}
protected:
string_type m_format;
@@ -371,53 +362,53 @@ namespace boost { namespace date_time {
template <class date_type, class CharT, class OutItrT>
std::locale::id date_facet<date_type, CharT, OutItrT>::id;
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '};
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
{'%', 'x' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
{'%', 'Y', '%', 'm', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
{'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::default_date_format[9] =
template <class date_type, class CharT, class OutItrT>
const typename date_facet<date_type, CharT, OutItrT>::char_type
date_facet<date_type, CharT, OutItrT>::default_date_format[9] =
{'%','Y','-','%','b','-','%','d'};
//! Input facet
template <class date_type,
class CharT,
class CharT,
class InItrT = std::istreambuf_iterator<CharT, std::char_traits<CharT> > >
class date_input_facet : public std::locale::facet {
class BOOST_SYMBOL_VISIBLE date_input_facet : public std::locale::facet {
public:
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
@@ -429,7 +420,7 @@ namespace boost { namespace date_time {
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef boost::date_time::period_parser<date_type, CharT> period_parser_type;
typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type;
typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type;
typedef std::vector<std::basic_string<CharT> > input_collection_type;
typedef format_date_parser<date_type, CharT> format_date_parser_type;
// date_generators stuff goes here
@@ -453,9 +444,9 @@ namespace boost { namespace date_time {
static const char_type iso_format_extended_specifier[9];
static const char_type default_date_format[9]; // YYYY-Mon-DD
static std::locale::id id;
explicit date_input_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
explicit date_input_facet(::size_t a_ref = 0)
: std::locale::facet(a_ref),
m_format(default_date_format),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
@@ -465,8 +456,8 @@ namespace boost { namespace date_time {
{}
explicit date_input_facet(const string_type& format_str,
::size_t a_ref = 0)
: std::locale::facet(a_ref),
::size_t a_ref = 0)
: std::locale::facet(a_ref),
m_format(format_str),
m_month_format(short_month_format),
m_weekday_format(short_weekday_format),
@@ -513,7 +504,7 @@ namespace boost { namespace date_time {
void year_format(const char_type* const format_str) {
m_year_format = format_str;
}
void period_parser(period_parser_type per_parser) {
m_period_parser = per_parser;
}
@@ -549,7 +540,7 @@ namespace boost { namespace date_time {
const string_type& before,
const string_type& after,
const string_type& of)
{
m_date_gen_parser.element_strings(first,second,third,fourth,fifth,last,before,after,of);
}
@@ -559,68 +550,68 @@ namespace boost { namespace date_time {
m_sv_parser = sv_parser;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
date_type& d) const
{
d = m_parser.parse_date(from, to, m_format, m_sv_parser);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
month_type& m) const
{
m = m_parser.parse_month(from, to, m_month_format);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
day_of_week_type& wd) const
{
wd = m_parser.parse_weekday(from, to, m_weekday_format);
return from;
}
//! Expects 1 or 2 digit day range: 1-31
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
day_type& d) const
{
d = m_parser.parse_var_day_of_month(from, to);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& /*a_ios*/,
year_type& y) const
{
y = m_parser.parse_year(from, to, m_year_format);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
duration_type& dd) const
{
// skip leading whitespace
while(std::isspace(*from) && from != to) { ++from; }
/* num_get.get() will always consume the first character if it
* is a sign indicator (+/-). Special value strings may begin
while(std::isspace(*from) && from != to) { ++from; }
/* num_get.get() will always consume the first character if it
* is a sign indicator (+/-). Special value strings may begin
* with one of these signs so we'll need a copy of it
* in case num_get.get() fails. */
char_type c = '\0';
char_type c = '\0';
// TODO Are these characters somewhere in the locale?
if(*from == '-' || *from == '+') {
if(*from == '-' || *from == '+') {
c = *from;
}
typedef std::num_get<CharT, InItrT> num_get;
typename duration_type::duration_rep_type val = 0;
std::ios_base::iostate err = std::ios_base::goodbit;
if (std::has_facet<num_get>(a_ios.getloc())) {
from = std::use_facet<num_get>(a_ios.getloc()).get(from, to, a_ios, err, val);
}
@@ -638,67 +629,68 @@ namespace boost { namespace date_time {
}
m_sv_parser.match(from, to, mr);
if(mr.current_match == match_results::PARSE_ERROR) {
throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'");
boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return from); // should never reach
}
dd = duration_type(static_cast<special_values>(mr.current_match));
dd = duration_type(static_cast<special_values>(mr.current_match));
}
else {
dd = duration_type(val);
}
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
period_type& p) const
{
p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this);
p = m_period_parser.get_period(from, to, a_ios, p, duration_type::unit(), *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
nth_kday_type& nkd) const
{
nkd = m_date_gen_parser.get_nth_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
partial_date_type& pd) const
{
pd = m_date_gen_parser.get_partial_date_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
first_kday_type& fkd) const
{
fkd = m_date_gen_parser.get_first_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
last_kday_type& lkd) const
{
lkd = m_date_gen_parser.get_last_kday_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
kday_before_type& fkb) const
{
fkb = m_date_gen_parser.get_kday_before_type(from, to, a_ios, *this);
return from;
}
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
InItrT get(InItrT& from,
InItrT& to,
std::ios_base& a_ios,
kday_after_type& fka) const
{
fka = m_date_gen_parser.get_kday_after_type(from, to, a_ios, *this);
@@ -721,55 +713,54 @@ namespace boost { namespace date_time {
template <class date_type, class CharT, class OutItrT>
std::locale::id date_input_facet<date_type, CharT, OutItrT>::id;
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::long_weekday_format[3] = {'%','A'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::short_weekday_format[3] = {'%','a'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::long_month_format[3] = {'%','B'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::short_month_format[3] = {'%','b'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::four_digit_year_format[3] = {'%','Y'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::two_digit_year_format[3] = {'%','y'};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::default_period_separator[4] = { ' ', '/', ' '};
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::standard_format_specifier[3] =
{'%', 'x' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_specifier[7] =
{'%', 'Y', '%', 'm', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::iso_format_extended_specifier[9] =
{'%', 'Y', '-', '%', 'm', '-', '%', 'd' };
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::default_date_format[9] =
template <class date_type, class CharT, class OutItrT>
const typename date_input_facet<date_type, CharT, OutItrT>::char_type
date_input_facet<date_type, CharT, OutItrT>::default_date_format[9] =
{'%','Y','-','%','b','-','%','d'};
} } // namespaces
#endif
+11 -1
View File
@@ -11,6 +11,7 @@
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <boost/io/ios_state.hpp>
#include <string>
#include <sstream>
#include <iomanip>
@@ -51,10 +52,13 @@ namespace date_time {
}
case month_as_integer:
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
break;
}
default:
break;
}
return os;
} // format_month
@@ -79,7 +83,13 @@ namespace date_time {
{
typedef typename ymd_type::month_type month_type;
std::basic_ostringstream<charT> ss;
// Temporarily switch to classic locale to prevent possible formatting
// of year with comma or other character (for example 2,008).
ss.imbue(std::locale::classic());
ss << ymd.year;
ss.imbue(std::locale());
if (format_type::has_date_sep_chars()) {
ss << format_type::month_sep_char();
}
@@ -17,6 +17,7 @@
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/date_names_put.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <boost/io/ios_state.hpp>
//#include <string>
#include <sstream>
#include <iomanip>
@@ -56,8 +57,8 @@ namespace date_time {
}
case month_as_integer:
{
charT fill_char = '0';
os << std::setw(2) << std::setfill(fill_char) << month.as_number();
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number();
break;
}
@@ -132,8 +133,8 @@ namespace date_time {
ostream_type& os,
const facet_type& f)
{
boost::io::basic_ios_fill_saver<charT> ifs(os);
std::ostreambuf_iterator<charT> oitr(os);
charT fill_char = '0';
switch (f.date_order()) {
case ymd_order_iso: {
os << ymd.year;
@@ -144,7 +145,7 @@ namespace date_time {
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
}
os << std::setw(2) << std::setfill(fill_char)
os << std::setw(2) << std::setfill(os.widen('0'))
<< ymd.day;
break;
}
@@ -153,7 +154,7 @@ namespace date_time {
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
}
os << std::setw(2) << std::setfill(fill_char)
os << std::setw(2) << std::setfill(os.widen('0'))
<< ymd.day;
if (f.has_date_sep_chars()) {
f.month_sep_char(oitr);
@@ -162,7 +163,7 @@ namespace date_time {
break;
}
case ymd_order_dmy: {
os << std::setw(2) << std::setfill(fill_char)
os << std::setw(2) << std::setfill(os.widen('0'))
<< ymd.day;
if (f.has_date_sep_chars()) {
f.day_sep_char(oitr);
@@ -63,6 +63,7 @@ namespace date_time {
//! Default format elements used
date_generator_formatter()
{
phrase_strings.reserve(number_of_phrase_elements);
phrase_strings.push_back(string_type(first_string));
phrase_strings.push_back(string_type(second_string));
phrase_strings.push_back(string_type(third_string));
@@ -75,25 +76,26 @@ namespace date_time {
}
//! Constructor that allows for a custom set of phrase elements
date_generator_formatter(const string_type& first,
const string_type& second,
const string_type& third,
const string_type& fourth,
const string_type& fifth,
const string_type& last,
const string_type& before,
const string_type& after,
const string_type& of)
date_generator_formatter(const string_type& first_str,
const string_type& second_str,
const string_type& third_str,
const string_type& fourth_str,
const string_type& fifth_str,
const string_type& last_str,
const string_type& before_str,
const string_type& after_str,
const string_type& of_str)
{
phrase_strings.push_back(string_type(first_string));
phrase_strings.push_back(string_type(second_string));
phrase_strings.push_back(string_type(third_string));
phrase_strings.push_back(string_type(fourth_string));
phrase_strings.push_back(string_type(fifth_string));
phrase_strings.push_back(string_type(last_string));
phrase_strings.push_back(string_type(before_string));
phrase_strings.push_back(string_type(after_string));
phrase_strings.push_back(string_type(of_string));
phrase_strings.reserve(number_of_phrase_elements);
phrase_strings.push_back(first_str);
phrase_strings.push_back(second_str);
phrase_strings.push_back(third_str);
phrase_strings.push_back(fourth_str);
phrase_strings.push_back(fifth_str);
phrase_strings.push_back(last_str);
phrase_strings.push_back(before_str);
phrase_strings.push_back(after_str);
phrase_strings.push_back(of_str);
}
//! Replace the set of phrase elements with those contained in new_strings
@@ -148,7 +150,7 @@ namespace date_time {
facet.put(next, a_ios, a_fill, nkd.month());
return next;
}
//! Put a first_day_of_the_week_in_month => "first weekday of month"
template<class facet_type>
OutItrT put_first_kday(OutItrT next, std::ios_base& a_ios,
@@ -10,12 +10,14 @@
* $Date$
*/
#include "boost/date_time/string_parse_tree.hpp"
#include "boost/date_time/date_generators.hpp"
#include "boost/date_time/format_date_parser.hpp"
#include <string>
#include <vector>
#include <iterator> // istreambuf_iterator
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/string_parse_tree.hpp>
#include <boost/date_time/date_generators.hpp>
#include <boost/date_time/format_date_parser.hpp>
namespace boost { namespace date_time {
@@ -66,10 +68,10 @@ namespace boost { namespace date_time {
static const char_type last_string[5];
static const char_type before_string[8];
static const char_type after_string[6];
static const char_type of_string[3];
static const char_type of_string[3];
enum phrase_elements {first=0, second, third, fourth, fifth, last,
before, after, of, number_of_phrase_elements};
before, after, of, number_of_phrase_elements};
//! Creates a date_generator_parser with the default set of "element_strings"
date_generator_parser()
@@ -96,7 +98,7 @@ namespace boost { namespace date_time {
const string_type& after_str,
const string_type& of_str)
{
element_strings(first_str, second_str, third_str, fourth_str, fifth_str,
element_strings(first_str, second_str, third_str, fourth_str, fifth_str,
last_str, before_str, after_str, of_str);
}
@@ -128,19 +130,18 @@ namespace boost { namespace date_time {
{
m_element_strings = parse_tree_type(col, this->first); // enum first
}
//! returns partial_date parsed from stream
template<class facet_type>
partial_date_type
get_partial_date_type(stream_itr_type& sitr,
get_partial_date_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
day_type d(1);
month_type m(1);
facet.get(sitr, stream_end, a_ios, d);
@@ -152,18 +153,18 @@ namespace boost { namespace date_time {
//! returns nth_kday_of_week parsed from stream
template<class facet_type>
nth_kday_type
get_nth_kday_type(stream_itr_type& sitr,
get_nth_kday_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
typename nth_kday_type::week_num wn;
day_of_week_type wd(0); // no default constructor
month_type m(1); // no default constructor
match_results mr = m_element_strings.match(sitr, stream_end);
switch(mr.current_match) {
case first : { wn = nth_kday_type::first; break; }
@@ -173,98 +174,98 @@ namespace boost { namespace date_time {
case fifth : { wn = nth_kday_type::fifth; break; }
default:
{
throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'");
break;
boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(wn = nth_kday_type::first);
}
} // week num
facet.get(sitr, stream_end, a_ios, wd); // day_of_week
extract_element(sitr, stream_end, of); // "of" element
facet.get(sitr, stream_end, a_ios, m); // month
return nth_kday_type(wn, wd, m);
}
//! returns first_kday_of_week parsed from stream
template<class facet_type>
first_kday_type
get_first_kday_type(stream_itr_type& sitr,
get_first_kday_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
day_of_week_type wd(0); // no default constructor
month_type m(1); // no default constructor
extract_element(sitr, stream_end, first); // "first" element
facet.get(sitr, stream_end, a_ios, wd); // day_of_week
extract_element(sitr, stream_end, of); // "of" element
facet.get(sitr, stream_end, a_ios, m); // month
return first_kday_type(wd, m);
}
//! returns last_kday_of_week parsed from stream
template<class facet_type>
last_kday_type
get_last_kday_type(stream_itr_type& sitr,
get_last_kday_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
day_of_week_type wd(0); // no default constructor
month_type m(1); // no default constructor
extract_element(sitr, stream_end, last); // "last" element
facet.get(sitr, stream_end, a_ios, wd); // day_of_week
extract_element(sitr, stream_end, of); // "of" element
facet.get(sitr, stream_end, a_ios, m); // month
return last_kday_type(wd, m);
}
//! returns first_kday_of_week parsed from stream
template<class facet_type>
kday_before_type
get_kday_before_type(stream_itr_type& sitr,
get_kday_before_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
day_of_week_type wd(0); // no default constructor
facet.get(sitr, stream_end, a_ios, wd); // day_of_week
extract_element(sitr, stream_end, before);// "before" element
return kday_before_type(wd);
}
//! returns first_kday_of_week parsed from stream
template<class facet_type>
kday_after_type
get_kday_after_type(stream_itr_type& sitr,
get_kday_after_type(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
std::ios_base& a_ios,
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
day_of_week_type wd(0); // no default constructor
facet.get(sitr, stream_end, a_ios, wd); // day_of_week
extract_element(sitr, stream_end, after); // "after" element
return kday_after_type(wd);
}
@@ -277,13 +278,13 @@ namespace boost { namespace date_time {
typename date_generator_parser::phrase_elements ele) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
match_results mr = m_element_strings.match(sitr, stream_end);
if(mr.current_match != ele) {
throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'");
boost::throw_exception(std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'"));
}
}
};
template<class date_type, class CharT>
+70 -65
View File
@@ -2,20 +2,22 @@
#define DATE_TIME_DATE_GENERATORS_HPP__
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* Author: Jeff Garland, Bart Garst
* $Date$
*/
/*! @file date_generators.hpp
Definition and implementation of date algorithm templates
*/
#include <stdexcept>
#include <sstream>
#include "boost/date_time/date.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <boost/date_time/date.hpp>
#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace date_time {
@@ -23,7 +25,7 @@ namespace date_time {
//! Base class for all generators that take a year and produce a date.
/*! This class is a base class for polymorphic function objects that take
a year and produce a concrete date.
@param date_type The type representing a date. This type must
@tparam date_type The type representing a date. This type must
export a calender_type which defines a year_type.
*/
template<class date_type>
@@ -32,16 +34,16 @@ namespace date_time {
public:
typedef typename date_type::calendar_type calendar_type;
typedef typename calendar_type::year_type year_type;
year_based_generator() {};
virtual ~year_based_generator() {};
year_based_generator() {}
virtual ~year_based_generator() {}
virtual date_type get_date(year_type y) const = 0;
//! Returns a string for use in a POSIX time_zone string
virtual std::string to_string() const =0;
virtual std::string to_string() const = 0;
};
//! Generates a date by applying the year to the given month and day.
/*!
Example usage:
Example usage:
@code
partial_date pd(1, Jan);
partial_date pd2(70);
@@ -96,16 +98,14 @@ namespace date_time {
* pg.get_date(2000); // returns 2000-2-29
* @endcode
*/
date_type get_date(year_type y) const
date_type get_date(year_type y) const BOOST_OVERRIDE
{
if((day_ == 29) && (month_ == 2) && !(calendar_type::is_leap_year(y))) {
std::stringstream ss("");
std::ostringstream ss;
ss << "No Feb 29th in given year of " << y << ".";
throw std::invalid_argument(ss.str());
//return date_type(1,1,1); // should never reach
} else {
return date_type(y, month_, day_);
boost::throw_exception(std::invalid_argument(ss.str()));
}
return date_type(y, month_, day_);
}
date_type operator()(year_type y) const
{
@@ -123,9 +123,9 @@ namespace date_time {
//months are equal
return (day_ < rhs.day_);
}
// added for streaming purposes
month_type month() const
month_type month() const
{
return month_;
}
@@ -135,15 +135,15 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns string formatted with up to 3 digits:
* Jan-01 == "0"
/*! Returns string formatted with up to 3 digits:
* Jan-01 == "0"
* Feb-29 == "58"
* Dec-31 == "365" */
virtual std::string to_string() const
std::string to_string() const BOOST_OVERRIDE
{
std::stringstream ss;
std::ostringstream ss;
date_type d(2004, month_, day_);
unsigned short c = d.day_of_year();
unsigned short c = d.day_of_year();
c--; // numbered 0-365 while day_of_year is 1 based...
ss << c;
return ss.str();
@@ -153,21 +153,33 @@ namespace date_time {
month_type month_;
};
//! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
inline const char* nth_as_str(int ele)
{
static const char* const _nth_as_str[] = {"out of range", "first", "second",
"third", "fourth", "fifth"};
if(ele >= 1 && ele <= 5) {
return _nth_as_str[ele];
}
else {
return _nth_as_str[0];
}
}
//! Useful generator functor for finding holidays
/*! Based on the idea in Cal. Calc. for finding holidays that are
* the 'first Monday of September'. When instantiated with
* 'fifth' kday of month, the result will be the last kday of month
* which can be the fourth or fifth depending on the structure of
* which can be the fourth or fifth depending on the structure of
* the month.
*
* The algorithm here basically guesses for the first
* day of the month. Then finds the first day of the correct
* type. That is, if the first of the month is a Tuesday
* and it needs Wenesday then we simply increment by a day
* and it needs Wednesday then we simply increment by a day
* and then we can add the length of a week until we get
* to the 'nth kday'. There are probably more efficient
* algorithms based on using a mod 7, but this one works
* to the 'nth kday'. There are probably more efficient
* algorithms based on using a mod 7, but this one works
* reasonably well for basic applications.
* \ingroup date_alg
*/
@@ -189,7 +201,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type y) const
date_type get_date(year_type y) const BOOST_OVERRIDE
{
date_type d(y, month_, 1); //first day of month
duration_type one_day(1);
@@ -227,10 +239,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.3.0" ==> 3rd Sunday in April. */
virtual std::string to_string() const
std::string to_string() const BOOST_OVERRIDE
{
std::stringstream ss;
ss << 'M'
std::ostringstream ss;
ss << 'M'
<< static_cast<int>(month_) << '.'
<< static_cast<int>(wn_) << '.'
<< static_cast<int>(dow_);
@@ -241,9 +253,6 @@ namespace date_time {
week_num wn_;
day_of_week_type dow_;
};
//! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
BOOST_DATE_TIME_DECL const char* nth_as_str(int n);
//! Useful generator functor for finding holidays and daylight savings
/*! Similar to nth_kday_of_month, but requires less paramters
@@ -267,7 +276,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type year) const
date_type get_date(year_type year) const BOOST_OVERRIDE
{
date_type d(year, month_,1);
duration_type one_day(1);
@@ -275,7 +284,7 @@ namespace date_time {
d = d + one_day;
}
return d;
}
}
// added for streaming
month_type month() const
{
@@ -287,10 +296,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.1.0" ==> 1st Sunday in April. */
virtual std::string to_string() const
std::string to_string() const BOOST_OVERRIDE
{
std::stringstream ss;
ss << 'M'
std::ostringstream ss;
ss << 'M'
<< static_cast<int>(month_) << '.'
<< 1 << '.'
<< static_cast<int>(dow_);
@@ -300,14 +309,14 @@ namespace date_time {
month_type month_;
day_of_week_type dow_;
};
//! Calculate something like Last Sunday of January
/*! Useful generator functor for finding holidays and daylight savings
* Get the last day of the month and then calculate the difference
* to the last previous day.
* @param date_type A date class that exports day_of_week, month_type, etc.
* @tparam date_type A date class that exports day_of_week, month_type, etc.
* \ingroup date_alg
*/
template<class date_type>
@@ -328,7 +337,7 @@ namespace date_time {
dow_(dow)
{}
//! Return a concrete date when provided with a year specific year.
date_type get_date(year_type year) const
date_type get_date(year_type year) const BOOST_OVERRIDE
{
date_type d(year, month_, calendar_type::end_of_month_day(year,month_));
duration_type one_day(1);
@@ -348,10 +357,10 @@ namespace date_time {
}
//! Returns string suitable for use in POSIX time zone string
/*! Returns a string formatted as "M4.5.0" ==> last Sunday in April. */
virtual std::string to_string() const
std::string to_string() const BOOST_OVERRIDE
{
std::stringstream ss;
ss << 'M'
std::ostringstream ss;
ss << 'M'
<< static_cast<int>(month_) << '.'
<< 5 << '.'
<< static_cast<int>(dow_);
@@ -361,8 +370,8 @@ namespace date_time {
month_type month_;
day_of_week_type dow_;
};
//! Calculate something like "First Sunday after Jan 1,2002
/*! Date generator that takes a date and finds kday after
*@code
@@ -400,7 +409,7 @@ namespace date_time {
private:
day_of_week_type dow_;
};
//! Calculate something like "First Sunday before Jan 1,2002
/*! Date generator that takes a date and finds kday after
*@code
@@ -438,10 +447,10 @@ namespace date_time {
private:
day_of_week_type dow_;
};
//! Calculates the number of days until the next weekday
/*! Calculates the number of days until the next weekday.
* If the date given falls on a Sunday and the given weekday
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 2 days */
template<typename date_type, class weekday_type>
inline
@@ -458,8 +467,8 @@ namespace date_time {
//! Calculates the number of days since the previous weekday
/*! Calculates the number of days since the previous weekday
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 5 days. The answer will be a positive
* If the date given falls on a Sunday and the given weekday
* is Tuesday the result will be 5 days. The answer will be a positive
* number because Tuesday is 5 days before Sunday, not -5 days before. */
template<typename date_type, class weekday_type>
inline
@@ -477,9 +486,9 @@ namespace date_time {
}
//! Generates a date object representing the date of the following weekday from the given date
/*! Generates a date object representing the date of the following
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
/*! Generates a date object representing the date of the following
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
* will be 2004-May-11. */
template<class date_type, class weekday_type>
inline
@@ -489,9 +498,9 @@ namespace date_time {
}
//! Generates a date object representing the date of the previous weekday from the given date
/*! Generates a date object representing the date of the previous
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
/*! Generates a date object representing the date of the previous
* weekday from the given date. If the date given is 2004-May-9
* (a Sunday) and the given weekday is Tuesday then the resulting date
* will be 2004-May-4. */
template<class date_type, class weekday_type>
inline
@@ -502,8 +511,4 @@ namespace date_time {
} } //namespace date_time
#endif
+19 -19
View File
@@ -2,7 +2,7 @@
#define DATE_ITERATOR_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
@@ -32,7 +32,7 @@ namespace date_time {
template<class date_type>
class date_itr_base {
// works, but benefit unclear at the moment
// class date_itr_base : public std::iterator<std::input_iterator_tag,
// class date_itr_base : public std::iterator<std::input_iterator_tag,
// date_type, void, void, void>{
public:
typedef typename date_type::duration_type duration_type;
@@ -40,31 +40,31 @@ namespace date_time {
typedef std::input_iterator_tag iterator_category;
date_itr_base(date_type d) : current_(d) {}
virtual ~date_itr_base() {};
date_itr_base& operator++()
virtual ~date_itr_base() {}
date_itr_base& operator++()
{
current_ = current_ + get_offset(current_);
return *this;
}
date_itr_base& operator--()
date_itr_base& operator--()
{
current_ = current_ + get_neg_offset(current_);
return *this;
}
virtual duration_type get_offset(const date_type& current) const=0;
virtual duration_type get_neg_offset(const date_type& current) const=0;
date_type operator*() {return current_;};
date_type* operator->() {return &current_;};
bool operator< (const date_type& d) {return current_ < d;}
bool operator<= (const date_type& d) {return current_ <= d;}
bool operator> (const date_type& d) {return current_ > d;}
bool operator>= (const date_type& d) {return current_ >= d;}
bool operator== (const date_type& d) {return current_ == d;}
bool operator!= (const date_type& d) {return current_ != d;}
const date_type& operator*() const {return current_;}
const date_type* operator->() const {return &current_;}
bool operator< (const date_type& d) const {return current_ < d;}
bool operator<= (const date_type& d) const {return current_ <= d;}
bool operator> (const date_type& d) const {return current_ > d;}
bool operator>= (const date_type& d) const {return current_ >= d;}
bool operator== (const date_type& d) const {return current_ == d;}
bool operator!= (const date_type& d) const {return current_ != d;}
private:
date_type current_;
};
//! Overrides the base date iterator providing hook for functors
/*
* <b>offset_functor</b>
@@ -77,9 +77,9 @@ namespace date_time {
class date_itr : public date_itr_base<date_type> {
public:
typedef typename date_type::duration_type duration_type;
date_itr(date_type d, int factor=1) :
date_itr_base<date_type>(d),
of_(factor)
date_itr(date_type d, int factor=1) :
date_itr_base<date_type>(d),
of_(factor)
{}
private:
virtual duration_type get_offset(const date_type& current) const
@@ -92,9 +92,9 @@ namespace date_time {
}
offset_functor of_;
};
} } //namespace date_time
+33 -32
View File
@@ -2,22 +2,23 @@
#define DATE_TIME_DATE_NAMES_PUT_HPP___
/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/locale_config.hpp" // set BOOST_DATE_TIME_NO_LOCALE
#include <boost/date_time/locale_config.hpp> // set BOOST_DATE_TIME_NO_LOCALE
#ifndef BOOST_DATE_TIME_NO_LOCALE
#include "boost/date_time/special_defs.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include "boost/lexical_cast.hpp"
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/lexical_cast.hpp>
#include <locale>
@@ -27,22 +28,22 @@ namespace date_time {
//! Output facet base class for gregorian dates.
/*! This class is a base class for date facets used to localize the
* names of months and the names of days in the week.
*
*
* Requirements of Config
* - define an enumeration month_enum that enumerates the months.
* - define an enumeration month_enum that enumerates the months.
* The enumeration should be '1' based eg: Jan==1
* - define as_short_string and as_long_string
*
* (see langer & kreft p334).
*
*
*/
template<class Config,
class charT = char,
class charT = char,
class OutputIterator = std::ostreambuf_iterator<charT> >
class date_names_put : public std::locale::facet
class BOOST_SYMBOL_VISIBLE date_names_put : public std::locale::facet
{
public:
date_names_put() {};
date_names_put() {}
typedef OutputIterator iter_type;
typedef typename Config::month_type month_type;
typedef typename Config::month_enum month_enum;
@@ -118,7 +119,7 @@ namespace date_time {
put_string(oitr, gm.as_short_string(c));
}
//! Default facet implementation uses month_type defaults
virtual void do_put_month_long(iter_type& oitr,
virtual void do_put_month_long(iter_type& oitr,
month_enum moy) const
{
month_type gm(moy);
@@ -160,7 +161,7 @@ namespace date_time {
string_type s(separator); //put in '-'
put_string(oitr, s);
}
//! Default for date order
//! Default for date order
virtual ymd_order_spec do_date_order() const
{
return ymd_order_iso;
@@ -186,29 +187,29 @@ namespace date_time {
}
}
};
template<class Config, class charT, class OutputIterator>
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = {
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = {
{'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'},
{'-','i','n','f','i','n','i','t','y'},
{'+','i','n','f','i','n','i','t','y'} };
template<class Config, class charT, class OutputIterator>
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::separator[2] =
const typename date_names_put<Config, charT, OutputIterator>::char_type
date_names_put<Config, charT, OutputIterator>::separator[2] =
{'-', '\0'} ;
//! Generate storage location for a std::locale::id
//! Generate storage location for a std::locale::id
template<class Config, class charT, class OutputIterator>
std::locale::id date_names_put<Config, charT, OutputIterator>::id;
//! A date name output facet that takes an array of char* to define strings
template<class Config,
class charT = char,
class charT = char,
class OutputIterator = std::ostreambuf_iterator<charT> >
class all_date_names_put : public date_names_put<Config, charT, OutputIterator>
class BOOST_SYMBOL_VISIBLE all_date_names_put : public date_names_put<Config, charT, OutputIterator>
{
public:
all_date_names_put(const charT* const month_short_names[],
@@ -230,29 +231,29 @@ namespace date_time {
separator_char_[0] = separator_char;
separator_char_[1] = '\0';
};
}
typedef OutputIterator iter_type;
typedef typename Config::month_enum month_enum;
typedef typename Config::weekday_enum weekday_enum;
typedef typename Config::special_value_enum special_value_enum;
const charT* const* get_short_month_names() const
const charT* const* get_short_month_names() const
{
return month_short_names_;
}
const charT* const* get_long_month_names() const
const charT* const* get_long_month_names() const
{
return month_long_names_;
}
const charT* const* get_special_value_names() const
const charT* const* get_special_value_names() const
{
return special_value_names_;
}
const charT* const* get_short_weekday_names()const
const charT* const* get_short_weekday_names()const
{
return weekday_short_names_;
}
const charT* const* get_long_weekday_names()const
const charT* const* get_long_weekday_names()const
{
return weekday_long_names_;
}
@@ -263,7 +264,7 @@ namespace date_time {
{
this->put_string(oitr, month_short_names_[moy-1]);
}
//! Long month names
//! Long month names
virtual void do_put_month_long(iter_type& oitr, month_enum moy) const
{
this->put_string(oitr, month_long_names_[moy-1]);
@@ -310,7 +311,7 @@ namespace date_time {
const charT* const* weekday_long_names_;
charT separator_char_[2];
ymd_order_spec order_spec_;
month_format_spec month_format_spec_;
month_format_spec month_format_spec_;
};
} } //namespace boost::date_time
+158 -115
View File
@@ -2,22 +2,25 @@
#define _DATE_TIME_DATE_PARSING_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/tokenizer.hpp"
#include "boost/lexical_cast.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <map>
#include <string>
#include <sstream>
#include <iterator>
#include <algorithm>
#include <boost/tokenizer.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/date_time/period.hpp>
#if defined(BOOST_NO_STD_LOCALE)
#if defined(BOOST_DATE_TIME_NO_LOCALE)
#include <cctype> // ::tolower(int)
#else
#include <locale> // std::tolower(char, locale)
@@ -29,90 +32,113 @@ namespace date_time {
//! A function to replace the std::transform( , , ,tolower) construct
/*! This function simply takes a string, and changes all the characters
* in that string to lowercase (according to the default system locale).
* In the event that a compiler does not support locales, the old
* In the event that a compiler does not support locales, the old
* C style tolower() is used.
*/
inline
std::string
convert_to_lower(const std::string& inp) {
std::string tmp;
unsigned i = 0;
#if defined(BOOST_NO_STD_LOCALE)
while(i < inp.length()) {
tmp += static_cast<char>(std::tolower(inp.at(i++)));
std::string
convert_to_lower(std::string inp)
{
#if !defined(BOOST_DATE_TIME_NO_LOCALE)
const std::locale loc(std::locale::classic());
#endif
std::string::size_type i = 0, n = inp.length();
for (; i < n; ++i) {
inp[i] =
#if defined(BOOST_DATE_TIME_NO_LOCALE)
static_cast<char>(std::tolower(inp[i]));
#else
static const std::locale loc(std::locale::classic());
while(i < inp.length()) {
// tolower and others were brought in to std for borland >= v564
// in compiler_config.hpp
std::string::value_type c(inp.at(i++));
tmp += std::tolower(c, loc);
std::tolower(inp[i], loc);
#endif
}
return tmp;
}
return inp;
}
//! Helper function for parse_date.
/* Used by-value parameter because we change the string and may
* want to preserve the original argument */
template<class month_type>
unsigned short
month_str_to_ushort(std::string s) {
inline unsigned short
month_str_to_ushort(std::string const& s) {
if((s.at(0) >= '0') && (s.at(0) <= '9')) {
return boost::lexical_cast<unsigned short>(s);
}
}
else {
s = convert_to_lower(s);
typename month_type::month_map_ptr_type ptr = month_type::get_month_map_ptr();
typename month_type::month_map_type::iterator iter = ptr->find(s);
if(iter != ptr->end()) { // required for STLport
return iter->second;
std::string str = convert_to_lower(s);
//c++98 support
#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
static std::map<std::string, unsigned short> month_map;
typedef std::map<std::string, unsigned short>::value_type vtype;
if( month_map.empty() ) {
month_map.insert( vtype("jan", static_cast<unsigned short>(1)) );
month_map.insert( vtype("january", static_cast<unsigned short>(1)) );
month_map.insert( vtype("feb", static_cast<unsigned short>(2)) );
month_map.insert( vtype("february", static_cast<unsigned short>(2)) );
month_map.insert( vtype("mar", static_cast<unsigned short>(3)) );
month_map.insert( vtype("march", static_cast<unsigned short>(3)) );
month_map.insert( vtype("apr", static_cast<unsigned short>(4)) );
month_map.insert( vtype("april", static_cast<unsigned short>(4)) );
month_map.insert( vtype("may", static_cast<unsigned short>(5)) );
month_map.insert( vtype("jun", static_cast<unsigned short>(6)) );
month_map.insert( vtype("june", static_cast<unsigned short>(6)) );
month_map.insert( vtype("jul", static_cast<unsigned short>(7)) );
month_map.insert( vtype("july", static_cast<unsigned short>(7)) );
month_map.insert( vtype("aug", static_cast<unsigned short>(8)) );
month_map.insert( vtype("august", static_cast<unsigned short>(8)) );
month_map.insert( vtype("sep", static_cast<unsigned short>(9)) );
month_map.insert( vtype("september", static_cast<unsigned short>(9)) );
month_map.insert( vtype("oct", static_cast<unsigned short>(10)) );
month_map.insert( vtype("october", static_cast<unsigned short>(10)) );
month_map.insert( vtype("nov", static_cast<unsigned short>(11)) );
month_map.insert( vtype("november", static_cast<unsigned short>(11)) );
month_map.insert( vtype("dec", static_cast<unsigned short>(12)) );
month_map.insert( vtype("december", static_cast<unsigned short>(12)) );
}
#else //c+11 and beyond
static std::map<std::string, unsigned short> month_map =
{ { "jan", static_cast<unsigned short>(1) }, { "january", static_cast<unsigned short>(1) },
{ "feb", static_cast<unsigned short>(2) }, { "february", static_cast<unsigned short>(2) },
{ "mar", static_cast<unsigned short>(3) }, { "march", static_cast<unsigned short>(3) },
{ "apr", static_cast<unsigned short>(4) }, { "april", static_cast<unsigned short>(4) },
{ "may", static_cast<unsigned short>(5) },
{ "jun", static_cast<unsigned short>(6) }, { "june", static_cast<unsigned short>(6) },
{ "jul", static_cast<unsigned short>(7) }, { "july", static_cast<unsigned short>(7) },
{ "aug", static_cast<unsigned short>(8) }, { "august", static_cast<unsigned short>(8) },
{ "sep", static_cast<unsigned short>(9) }, { "september", static_cast<unsigned short>(9) },
{ "oct", static_cast<unsigned short>(10) }, { "october", static_cast<unsigned short>(10)},
{ "nov", static_cast<unsigned short>(11) }, { "november", static_cast<unsigned short>(11)},
{ "dec", static_cast<unsigned short>(12) }, { "december", static_cast<unsigned short>(12)}
};
#endif
std::map<std::string, unsigned short>::const_iterator mitr = month_map.find( str );
if ( mitr != month_map.end() ) {
return mitr->second;
}
}
return 13; // intentionally out of range - name not found
}
//! Find index of a string in either of 2 arrays
/*! find_match searches both arrays for a match to 's'. Indexing of the
* arrays is from 0 to 'limit'. The index of the match is returned.
* Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2.
* 'limit' can be sent in with: greg_month::max(),
* greg_weekday::max() or date_time::NumSpecialValues */
template<class charT>
short find_match(const charT* const* short_names,
const charT* const* long_names,
short limit,
const std::basic_string<charT>& s) {
for(short i = 0; i <= limit; ++i){
if(short_names[i] == s || long_names[i] == s){
return i;
}
}
return static_cast<short>(limit + 1); // not-found, return a value out of range
}
//! Generic function to parse a delimited date (eg: 2002-02-10)
/*! Accepted formats are: "2003-02-10" or " 2003-Feb-10" or
* "2003-Feburary-10"
* The order in which the Month, Day, & Year appear in the argument
* string can be accomodated by passing in the appropriate ymd_order_spec
* "2003-Feburary-10"
* The order in which the Month, Day, & Year appear in the argument
* string can be accomodated by passing in the appropriate ymd_order_spec
*/
template<class date_type>
date_type
parse_date(const std::string& s, int order_spec = ymd_order_iso) {
std::string spec_str("");
std::string spec_str;
if(order_spec == ymd_order_iso) {
spec_str = "ymd";
}
}
else if(order_spec == ymd_order_dmy) {
spec_str = "dmy";
}
}
else { // (order_spec == ymd_order_us)
spec_str = "mdy";
}
typedef typename date_type::year_type year_type;
typedef typename date_type::month_type month_type;
unsigned pos = 0;
unsigned short year(0), month(0), day(0);
@@ -128,49 +154,49 @@ namespace date_time {
const char sep_char[] = {',','-','.',' ','/','\0'};
char_separator_type sep(sep_char);
tokenizer tok(s,sep);
for(tokenizer_iterator beg=tok.begin();
beg!=tok.end() && pos < spec_str.size();
for(tokenizer_iterator beg=tok.begin();
beg!=tok.end() && pos < spec_str.size();
++beg, ++pos) {
switch(spec_str.at(pos)) {
case 'y':
case 'y':
{
year = boost::lexical_cast<unsigned short>(*beg);
break;
}
case 'm':
case 'm':
{
month = month_str_to_ushort<month_type>(*beg);
break;
}
case 'd':
case 'd':
{
day = boost::lexical_cast<unsigned short>(*beg);
break;
}
default: break;
} //switch
}
return date_type(year, month, day);
}
//! Generic function to parse undelimited date (eg: 20020201)
template<class date_type>
date_type
parse_undelimited_date(const std::string& s) {
int offsets[] = {4,2,2};
int pos = 0;
typedef typename date_type::year_type year_type;
//typename date_type::ymd_type ymd((year_type::min)(),1,1);
unsigned short y = 0, m = 0, d = 0;
/* The two bool arguments state that parsing will not wrap
* (only the first 8 characters will be parsed) and partial
* strings will not be parsed.
/* The two bool arguments state that parsing will not wrap
* (only the first 8 characters will be parsed) and partial
* strings will not be parsed.
* Ex:
* "2005121" will parse 2005 & 12, but not the "1" */
boost::offset_separator osf(offsets, offsets+3, false, false);
typedef typename boost::tokenizer<boost::offset_separator,
std::basic_string<char>::const_iterator,
typedef typename boost::tokenizer<boost::offset_separator,
std::basic_string<char>::const_iterator,
std::basic_string<char> > tokenizer_type;
tokenizer_type tok(s, osf);
for(typename tokenizer_type::iterator ti=tok.begin(); ti!=tok.end();++ti) {
@@ -179,39 +205,40 @@ namespace date_time {
case 0: y = i; break;
case 1: m = i; break;
case 2: d = i; break;
default: break;
}
pos++;
}
return date_type(y,m,d);
}
//! Helper function for 'date gregorian::from_stream()'
/*! Creates a string from the iterators that reference the
* begining & end of a char[] or string. All elements are
* begining & end of a char[] or string. All elements are
* used in output string */
template<class date_type, class iterator_type>
inline
inline
date_type
from_stream_type(iterator_type& beg,
iterator_type& end,
char)
from_stream_type(iterator_type& beg,
iterator_type const& end,
char)
{
std::stringstream ss("");
std::ostringstream ss;
while(beg != end) {
ss << *beg++;
}
return parse_date<date_type>(ss.str());
}
//! Helper function for 'date gregorian::from_stream()'
/*! Returns the first string found in the stream referenced by the
* begining & end iterators */
template<class date_type, class iterator_type>
inline
inline
date_type
from_stream_type(iterator_type& beg,
iterator_type& end,
std::string)
from_stream_type(iterator_type& beg,
iterator_type const& /* end */,
std::string const&)
{
return parse_date<date_type>(*beg);
}
@@ -220,22 +247,30 @@ namespace date_time {
* parse_date<>()? In the mean time this gets us started... */
//! Helper function for 'date gregorian::from_stream()'
/*! Creates a string from the iterators that reference the
* begining & end of a wstring. All elements are
* begining & end of a wstring. All elements are
* used in output string */
template<class date_type, class iterator_type>
inline
date_type from_stream_type(iterator_type& beg,
iterator_type& end,
wchar_t)
inline
date_type from_stream_type(iterator_type& beg,
iterator_type const& end,
wchar_t)
{
std::stringstream ss("");
while(beg != end) {
std::ostringstream ss;
#if !defined(BOOST_DATE_TIME_NO_LOCALE)
ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*beg++, 'X'); // 'X' will cause exception to be thrown
#else
ss << ss.narrow(*beg++, 'X');
#endif
std::locale loc;
std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc);
while(beg != end) {
ss << fac.narrow(*beg++, 'X'); // 'X' will cause exception to be thrown
}
#else
while(beg != end) {
char c = 'X'; // 'X' will cause exception to be thrown
const wchar_t wc = *beg++;
if (wc >= 0 && wc <= 127)
c = static_cast< char >(wc);
ss << c;
}
#endif
return parse_date<date_type>(ss.str());
}
#ifndef BOOST_NO_STD_WSTRING
@@ -243,21 +278,29 @@ namespace date_time {
/*! Creates a string from the first wstring found in the stream
* referenced by the begining & end iterators */
template<class date_type, class iterator_type>
inline
inline
date_type
from_stream_type(iterator_type& beg,
iterator_type& end,
std::wstring) {
from_stream_type(iterator_type& beg,
iterator_type const& /* end */,
std::wstring const&) {
std::wstring ws = *beg;
std::stringstream ss("");
std::ostringstream ss;
std::wstring::iterator wsb = ws.begin(), wse = ws.end();
while(wsb != wse) {
#if !defined(BOOST_DATE_TIME_NO_LOCALE)
ss << std::use_facet<std::ctype<wchar_t> >(std::locale()).narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
#else
ss << ss.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
#endif
std::locale loc;
std::ctype<wchar_t> const& fac = std::use_facet<std::ctype<wchar_t> >(loc);
while(wsb != wse) {
ss << fac.narrow(*wsb++, 'X'); // 'X' will cause exception to be thrown
}
#else
while(wsb != wse) {
char c = 'X'; // 'X' will cause exception to be thrown
const wchar_t wc = *wsb++;
if (wc >= 0 && wc <= 127)
c = static_cast< char >(wc);
ss << c;
}
#endif
return parse_date<date_type>(ss.str());
}
#endif // BOOST_NO_STD_WSTRING
@@ -266,30 +309,30 @@ namespace date_time {
#else
//! function called by wrapper functions: date_period_from_(w)string()
template<class date_type, class charT>
period<date_type, typename date_type::duration_type>
period<date_type, typename date_type::duration_type>
from_simple_string_type(const std::basic_string<charT>& s){
typedef typename std::basic_string<charT>::traits_type traits_type;
typedef typename boost::char_separator<charT, traits_type> char_separator;
typedef typename boost::tokenizer<char_separator,
typename std::basic_string<charT>::const_iterator,
typedef typename boost::tokenizer<char_separator,
typename std::basic_string<charT>::const_iterator,
std::basic_string<charT> > tokenizer;
const charT sep_list[4] = {'[','/',']','\0'};
char_separator sep(sep_list);
tokenizer tokens(s, sep);
typename tokenizer::iterator tok_it = tokens.begin();
typename tokenizer::iterator tok_it = tokens.begin();
std::basic_string<charT> date_string = *tok_it;
// get 2 string iterators and generate a date from them
typename std::basic_string<charT>::iterator date_string_start = date_string.begin(),
date_string_end = date_string.end();
typename std::basic_string<charT>::iterator date_string_start = date_string.begin(),
date_string_end = date_string.end();
typedef typename std::iterator_traits<typename std::basic_string<charT>::iterator>::value_type value_type;
date_type d1 = from_stream_type<date_type>(date_string_start, date_string_end, value_type());
date_string = *(++tok_it); // next token
date_string_start = date_string.begin(), date_string_end = date_string.end();
date_string_start = date_string.begin(), date_string_end = date_string.end();
date_type d2 = from_stream_type<date_type>(date_string_start, date_string_end, value_type());
return period<date_type, typename date_type::duration_type>(d1, d2);
return period<date_type, typename date_type::duration_type>(d1, d2);
}
#endif
} } //namespace date_time
+66 -66
View File
@@ -2,7 +2,7 @@
#define DATE_TIME_DST_RULES_HPP__
/* Copyright (c) 2002,2003, 2007 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
@@ -21,12 +21,12 @@
namespace boost {
namespace date_time {
enum time_is_dst_result {is_not_in_dst, is_in_dst,
enum time_is_dst_result {is_not_in_dst, is_in_dst,
ambiguous, invalid_time_label};
//! Dynamic class used to caluclate dst transition information
template<class date_type_,
template<class date_type_,
class time_duration_type_>
class dst_calculator
{
@@ -37,14 +37,14 @@ namespace boost {
//! Check the local time offset when on dst start day
/*! On this dst transition, the time label between
* the transition boundary and the boudary + the offset
* are invalid times. If before the boundary then still
* not in dst.
* are invalid times. If before the boundary then still
* not in dst.
*@param time_of_day Time offset in the day for the local time
*@param dst_start_offset_minutes Local day offset for start of dst
*@param dst_length_minutes Number of minutes to adjust clock forward
*@retval status of time label w.r.t. dst
*/
static time_is_dst_result
static time_is_dst_result
process_local_dst_start_day(const time_duration_type& time_of_day,
unsigned int dst_start_offset_minutes,
long dst_length_minutes)
@@ -57,19 +57,19 @@ namespace boost {
if (time_of_day >= time_duration_type(0,offset,0)) {
return is_in_dst;
}
return invalid_time_label;
return invalid_time_label;
}
//! Check the local time offset when on the last day of dst
/*! This is the calculation for the DST end day. On that day times
* prior to the conversion time - dst_length (1 am in US) are still
* in dst. Times between the above and the switch time are
* prior to the conversion time - dst_length (1 am in US) are still
* in dst. Times between the above and the switch time are
* ambiguous. Times after the start_offset are not in dst.
*@param time_of_day Time offset in the day for the local time
*@param dst_end_offset_minutes Local time of day for end of dst
*@retval status of time label w.r.t. dst
*/
static time_is_dst_result
static time_is_dst_result
process_local_dst_end_day(const time_duration_type& time_of_day,
unsigned int dst_end_offset_minutes,
long dst_length_minutes)
@@ -86,32 +86,32 @@ namespace boost {
}
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @param current_day The day to check for dst
* @param time_of_day Time offset within the day to check
* @param time_of_day Time offset within the day to check
* @param dst_start_day Starting day of dst for the given locality
* @param dst_start_offset Time offset within day for dst boundary
* @param dst_end_day Ending day of dst for the given locality
* @param dst_end_offset Time offset within day given in dst for dst boundary
* @param dst_length lenght of dst adjusment
* @param dst_length_minutes length of dst adjusment
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result
static time_is_dst_result
local_is_dst(const date_type& current_day,
const time_duration_type& time_of_day,
const date_type& dst_start_day,
const time_duration_type& dst_start_offset,
const date_type& dst_end_day,
const time_duration_type& dst_end_offset,
const time_duration_type& dst_length_minutes)
const time_duration_type& dst_length)
{
unsigned int start_minutes =
dst_start_offset.hours() * 60 + dst_start_offset.minutes();
unsigned int end_minutes =
dst_end_offset.hours() * 60 + dst_end_offset.minutes();
long length_minutes =
dst_length_minutes.hours() * 60 + dst_length_minutes.minutes();
unsigned int start_minutes = static_cast<unsigned>(
dst_start_offset.hours() * 60 + dst_start_offset.minutes());
unsigned int end_minutes = static_cast<unsigned>(
dst_end_offset.hours() * 60 + dst_end_offset.minutes());
long length_minutes = static_cast<long>(
dst_length.hours() * 60 + dst_length.minutes());
return local_is_dst(current_day, time_of_day,
dst_start_day, start_minutes,
@@ -120,20 +120,20 @@ namespace boost {
}
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @param current_day The day to check for dst
* @param time_of_day Time offset within the day to check
* @param time_of_day Time offset within the day to check
* @param dst_start_day Starting day of dst for the given locality
* @param dst_start_offset_minutes Offset within day for dst
* @param dst_start_offset_minutes Offset within day for dst
* boundary (eg 120 for US which is 02:00:00)
* @param dst_end_day Ending day of dst for the given locality
* @param dst_end_offset_minutes Offset within day given in dst for dst
* @param dst_end_offset_minutes Offset within day given in dst for dst
* boundary (eg 120 for US which is 02:00:00)
* @param dst_length_minutes Length of dst adjusment (eg: 60 for US)
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result
static time_is_dst_result
local_is_dst(const date_type& current_day,
const time_duration_type& time_of_day,
const date_type& dst_start_day,
@@ -165,7 +165,7 @@ namespace boost {
dst_start_offset_minutes,
dst_length_minutes);
}
if (current_day == dst_end_day) {
return process_local_dst_end_day(time_of_day,
dst_end_offset_minutes,
@@ -183,29 +183,29 @@ namespace boost {
* calculation at compile time covering all the cases. Unfortunately
* because of the number of dimensions related to daylight savings
* calculation the number of parameters is high. In addition, the
* start and end transition rules are complex types that specify
* start and end transition rules are complex types that specify
* an algorithm for calculation of the starting day and ending
* day of daylight savings time including the month and day
* day of daylight savings time including the month and day
* specifications (eg: last sunday in October).
*
* @param date_type A type that represents dates, typically gregorian::date
* @param time_duration_type Used for the offset in the day calculations
* @param dst_traits A set of traits that define the rules of dst
* @param dst_traits A set of traits that define the rules of dst
* calculation. The dst_trait must include the following:
* start_rule_functor - Rule to calculate the starting date of a
* dst transition (eg: last_kday_of_month).
* start_day - static function that returns month of dst start for
* start_day - static function that returns month of dst start for
* start_rule_functor
* start_month -static function that returns day or day of week for
* start_month -static function that returns day or day of week for
* dst start of dst
* end_rule_functor - Rule to calculate the end of dst day.
* end_day - static fucntion that returns end day for end_rule_functor
* end_month - static function that returns end month for end_rule_functor
* dst_start_offset_minutes - number of minutes from start of day to transition to dst -- 120 (or 2:00 am) is typical for the U.S. and E.U.
* dst_start_offset_minutes - number of minutes from start of day to transition off of dst -- 180 (or 3:00 am) is typical for E.U.
* dst_start_offset_minutes - number of minutes from start of day to transition off of dst -- 180 (or 3:00 am) is typical for E.U.
* dst_length_minutes - number of minutes that dst shifts clock
*/
template<class date_type,
template<class date_type,
class time_duration_type,
class dst_traits>
class dst_calc_engine
@@ -216,12 +216,12 @@ namespace boost {
typedef dst_calculator<date_type, time_duration_type> dstcalc;
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result local_is_dst(const date_type& d,
const time_duration_type& td)
const time_duration_type& td)
{
year_type y = d.year();
@@ -230,10 +230,10 @@ namespace boost {
return dstcalc::local_is_dst(d,td,
dst_start,
dst_traits::dst_start_offset_minutes(),
dst_end,
dst_traits::dst_end_offset_minutes(),
dst_end,
dst_traits::dst_end_offset_minutes(),
dst_traits::dst_shift_length_minutes());
}
static bool is_dst_boundary_day(date_type d)
@@ -244,14 +244,14 @@ namespace boost {
}
//! The time of day for the dst transition (eg: typically 01:00:00 or 02:00:00)
static time_duration_type dst_offset()
static time_duration_type dst_offset()
{
return time_duration_type(0,dst_traits::dst_shift_length_minutes(),0);
}
static date_type local_dst_start_day(year_type year)
{
return dst_traits::local_dst_start_day(year);
return dst_traits::local_dst_start_day(year);
}
static date_type local_dst_end_day(year_type year)
@@ -267,11 +267,11 @@ namespace boost {
* In 2007 US/Canada DST rules changed
* (http://en.wikipedia.org/wiki/Energy_Policy_Act_of_2005#Change_to_daylight_saving_time).
*/
template<class date_type_,
template<class date_type_,
class time_duration_type_,
unsigned int dst_start_offset_minutes=120, //from start of day
unsigned int dst_start_offset_minutes=120, //from start of day
short dst_length_minutes=60> //1 hour == 60 min in US
class us_dst_rules
class us_dst_rules
{
public:
typedef time_duration_type_ time_duration_type;
@@ -284,12 +284,12 @@ namespace boost {
typedef dst_calculator<date_type, time_duration_type> dstcalc;
//! Calculates if the given local time is dst or not
/*! Determines if the time is really in DST or not. Also checks for
/*! Determines if the time is really in DST or not. Also checks for
* invalid and ambiguous.
* @retval The time is either ambiguous, invalid, in dst, or not in dst
*/
static time_is_dst_result local_is_dst(const date_type& d,
const time_duration_type& td)
const time_duration_type& td)
{
year_type y = d.year();
@@ -297,9 +297,9 @@ namespace boost {
date_type dst_end = local_dst_end_day(y);
return dstcalc::local_is_dst(d,td,
dst_start,dst_start_offset_minutes,
dst_end, dst_start_offset_minutes,
dst_end, dst_start_offset_minutes,
dst_length_minutes);
}
@@ -314,12 +314,12 @@ namespace boost {
{
if (year >= year_type(2007)) {
//second sunday in march
nkday ssim(nkday::second, Sunday, gregorian::Mar);
return ssim.get_date(year);
nkday ssim(nkday::second, Sunday, date_time::Mar);
return ssim.get_date(year);
} else {
//first sunday in april
fkday fsia(Sunday, gregorian::Apr);
return fsia.get_date(year);
fkday fsia(Sunday, date_time::Apr);
return fsia.get_date(year);
}
}
@@ -327,11 +327,11 @@ namespace boost {
{
if (year >= year_type(2007)) {
//first sunday in november
fkday fsin(Sunday, gregorian::Nov);
return fsin.get_date(year);
fkday fsin(Sunday, date_time::Nov);
return fsin.get_date(year);
} else {
//last sunday in october
lkday lsio(Sunday, gregorian::Oct);
lkday lsio(Sunday, date_time::Oct);
return lsio.get_date(year);
}
}
@@ -358,25 +358,25 @@ namespace boost {
//! Calculates if the given local time is dst or not
/*! @retval Always is_not_in_dst since this is for zones without dst
*/
static time_is_dst_result local_is_dst(const date_type&,
const time_duration_type&)
{
return is_not_in_dst;
}
//! Calculates if the given utc time is in dst
static time_is_dst_result utc_is_dst(const date_type&,
const time_duration_type&)
static time_is_dst_result local_is_dst(const date_type&,
const time_duration_type&)
{
return is_not_in_dst;
}
static bool is_dst_boundary_day(date_type d)
//! Calculates if the given utc time is in dst
static time_is_dst_result utc_is_dst(const date_type&,
const time_duration_type&)
{
return is_not_in_dst;
}
static bool is_dst_boundary_day(date_type /*d*/)
{
return false;
}
static time_duration_type dst_offset()
static time_duration_type dst_offset()
{
return time_duration_type(0,0,0);
}
@@ -7,7 +7,7 @@
#ifndef DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
#define DATE_TIME_DATE_DST_TRANSITION_DAY_GEN_HPP__
#include <string>
namespace boost {
namespace date_time {
@@ -18,7 +18,7 @@ namespace date_time {
{
public:
typedef typename date_type::year_type year_type;
virtual ~dst_day_calc_rule() {};
virtual ~dst_day_calc_rule() {}
virtual date_type start_day(year_type y) const=0;
virtual std::string start_rule_as_string() const=0;
virtual date_type end_day(year_type y) const=0;
@@ -29,7 +29,7 @@ namespace date_time {
//! Canonical form for a class that provides day rule calculation
/*! This class is used to generate specific sets of dst rules
*
*@param spec Provides a specifiction of the function object types used
*@tparam spec Provides a specifiction of the function object types used
* to generate start and end days of daylight savings as well
* as the date type.
*/
+45 -39
View File
@@ -10,66 +10,72 @@
*/
/*! @file filetime_functions.hpp
* Function(s) for converting between a FILETIME structure and a
* Function(s) for converting between a FILETIME structure and a
* time object. This file is only available on systems that have
* BOOST_HAS_FTIME defined.
*/
#include <boost/date_time/compiler_config.hpp>
#if defined(BOOST_HAS_FTIME) // skip this file if no FILETIME
#include <windows.h>
#include <boost/cstdint.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/date_defs.hpp>
namespace boost {
namespace date_time {
//! Create a time object from an initialized FILETIME struct.
/*!
* Create a time object from an initialized FILETIME struct.
* A FILETIME struct holds 100-nanosecond units (0.0000001). When
* built with microsecond resolution the file_time's sub second value
* will be truncated. Nanosecond resolution has no truncation.
*
* \note The function is templated on the FILETIME type, so that
* it can be used with both native FILETIME and the ad-hoc
* boost::detail::winapi::FILETIME_ type.
*/
template< typename TimeT, typename FileTimeT >
inline
TimeT time_from_ftime(const FileTimeT& ft)
{
typedef typename TimeT::date_type date_type;
typedef typename TimeT::date_duration_type date_duration_type;
typedef typename TimeT::time_duration_type time_duration_type;
//! Create a time object from an initialized FILETIME struct.
/*! Create a time object from an initialized FILETIME struct.
* A FILETIME struct holds 100-nanosecond units (0.0000001). When
* built with microsecond resolution the FILETIME's sub second value
* will be truncated. Nanosecond resolution has no truncation. */
template<class time_type>
inline
time_type time_from_ftime(const FILETIME& ft){
typedef typename time_type::date_type date_type;
typedef typename time_type::date_duration_type date_duration_type;
typedef typename time_type::time_duration_type time_duration_type;
// https://svn.boost.org/trac/boost/ticket/2523
// Since this function can be called with arbitrary times, including ones that
// are before 1970-Jan-01, we'll have to cast the time a bit differently,
// than it is done in the microsec_clock::file_time_to_microseconds function. This allows to
// avoid integer wrapping for dates before 1970-Jan-01.
/* OFFSET is difference between 1970-Jan-01 & 1601-Jan-01
* in 100-nanosecond intervals */
uint64_t c1 = 27111902UL;
uint64_t c2 = 3577643008UL; // issues warning without 'UL'
const uint64_t OFFSET = (c1 << 32) + c2;
const long sec_pr_day = 86400; // seconds per day
uint64_t filetime = ft.dwHighDateTime;
filetime <<= 32;
filetime += ft.dwLowDateTime;
filetime -= OFFSET; // filetime is now 100-nanos since 1970-Jan-01
uint64_t sec = filetime / 10000000;
#if defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
uint64_t sub_sec = (filetime % 10000000) * 100; // nanoseconds
// 100-nanos since 1601-Jan-01
uint64_t ft_as_integer = (static_cast< uint64_t >(ft.dwHighDateTime) << 32) | static_cast< uint64_t >(ft.dwLowDateTime);
uint64_t sec = ft_as_integer / 10000000UL;
uint32_t sub_sec = static_cast< uint32_t >(ft_as_integer % 10000000UL) // 100-nanoseconds since the last second
#if !defined(BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG)
/ 10U; // microseconds since the last second
#else
uint64_t sub_sec = (filetime % 10000000) / 10; // truncate to microseconds
* 100U; // nanoseconds since the last second
#endif
// split sec into usable chunks: days, hours, minutes, & seconds
long _d = sec / sec_pr_day;
long tmp = sec % sec_pr_day;
long _h = tmp / 3600; // sec_pr_hour
const uint32_t sec_per_day = 86400; // seconds per day
uint32_t days = static_cast< uint32_t >(sec / sec_per_day);
uint32_t tmp = static_cast< uint32_t >(sec % sec_per_day);
uint32_t hours = tmp / 3600; // sec_per_hour
tmp %= 3600;
long _m = tmp / 60; // sec_pr_min
uint32_t minutes = tmp / 60; // sec_per_min
tmp %= 60;
long _s = tmp; // seconds
uint32_t seconds = tmp; // seconds
date_duration_type dd(_d);
date_type d = date_type(1970, Jan, 01) + dd;
return time_type(d, time_duration_type(_h, _m, _s, sub_sec));
}
date_duration_type dd(days);
date_type d = date_type(1601, Jan, 01) + dd;
return TimeT(d, time_duration_type(hours, minutes, seconds, sub_sec));
}
}} // boost::date_time
+42
View File
@@ -0,0 +1,42 @@
#ifndef _BOOST_DATE_TIME_FIND_MATCH_HPP___
#define _BOOST_DATE_TIME_FIND_MATCH_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <string>
namespace boost {
namespace date_time {
//! Find index of a string in either of 2 arrays
/*! find_match searches both arrays for a match to 's'. Both arrays
* must contain 'size' elements. The index of the match is returned.
* If no match is found, 'size' is returned.
* Ex. "Jan" returns 0, "Dec" returns 11, "Tue" returns 2.
* 'size' can be sent in with: (greg_month::max)() (which 12),
* (greg_weekday::max)() + 1 (which is 7) or date_time::NumSpecialValues */
template<class charT>
short find_match(const charT* const* short_names,
const charT* const* long_names,
short size,
const std::basic_string<charT>& s) {
for(short i = 0; i < size; ++i){
if(short_names[i] == s || long_names[i] == s){
return i;
}
}
return size; // not-found, return a value out of range
}
} } //namespace date_time
#endif
+127 -134
View File
@@ -3,7 +3,7 @@
#define DATE_TIME_FORMAT_DATE_PARSER_HPP__
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
@@ -17,13 +17,26 @@
#include "boost/date_time/special_values_parser.hpp"
#include <string>
#include <vector>
#include <sstream>
#include <iterator>
#ifndef BOOST_NO_STDC_NAMESPACE
# include <cctype>
#else
# include <ctype.h>
#endif
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std {
using ::isspace;
using ::isdigit;
}
#endif
namespace boost { namespace date_time {
//! Helper function for parsing fixed length strings into integers
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
* digits in stream. */
template<typename int_type, typename charT>
inline
@@ -37,12 +50,12 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
//typedef std::basic_string<charT> string_type;
unsigned int j = 0;
//string_type s;
while (j < length && itr != stream_end &&
while (j < length && itr != stream_end &&
(std::isdigit(*itr) || *itr == fill_char)) {
if(*itr == fill_char) {
/* Since a fill_char can be anything, we convert it to a zero.
/* Since a fill_char can be anything, we convert it to a zero.
* lexical_cast will behave predictably when zero is used as fill. */
mr.cache += ('0');
mr.cache += ('0');
}
else {
mr.cache += (*itr);
@@ -50,23 +63,23 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
itr++;
j++;
}
int_type i = -1;
int_type i = static_cast<int_type>(-1);
// mr.cache will hold leading zeros. size() tells us when input is too short.
if(mr.cache.size() < length) {
return i;
}
try {
i = boost::lexical_cast<int_type>(mr.cache);
}catch(bad_lexical_cast blc){
}catch(bad_lexical_cast&){
// we want to return -1 if the cast fails so nothing to do here
}
return i;
}
//! Helper function for parsing fixed length strings into integers
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
/*! Will consume 'length' number of characters from stream. Consumed
* character are transfered to parse_match_result struct.
* Returns '-1' if no number can be parsed or incorrect number of
* digits in stream. */
template<typename int_type, typename charT>
inline
@@ -80,26 +93,26 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
}
//! Helper function for parsing varied length strings into integers
/*! Will consume 'max_length' characters from stream only if those
* characters are digits. Returns '-1' if no number can be parsed.
/*! Will consume 'max_length' characters from stream only if those
* characters are digits. Returns '-1' if no number can be parsed.
* Will not parse a number preceeded by a '+' or '-'. */
template<typename int_type, typename charT>
inline
int_type
var_string_to_int(std::istreambuf_iterator<charT>& itr,
std::istreambuf_iterator<charT>& /* stream_end */,
const std::istreambuf_iterator<charT>& stream_end,
unsigned int max_length)
{
typedef std::basic_string<charT> string_type;
unsigned int j = 0;
string_type s;
while ((j < max_length) && std::isdigit(*itr)) {
while (itr != stream_end && (j < max_length) && std::isdigit(*itr)) {
s += (*itr);
itr++;
j++;
++itr;
++j;
}
int_type i = -1;
if(s.length() != 0) {
int_type i = static_cast<int_type>(-1);
if(!s.empty()) {
i = boost::lexical_cast<int_type>(s);
}
return i;
@@ -120,7 +133,7 @@ var_string_to_int(std::istreambuf_iterator<charT>& itr,
- %W - Week number 00 to 53 where Monday is first day of week 1
- %x - facet default date representation
- %y - Year without the century - eg: 04 for 2004
- %Y - Year with century
- %Y - Year with century
The weekday specifiers (%a and %A) do not add to the date construction,
but they provide a way to skip over the weekday names for formats that
@@ -129,7 +142,7 @@ var_string_to_int(std::istreambuf_iterator<charT>& itr,
todo -- Another interesting feature that this approach could provide is
an option to fill in any missing fields with the current values
from the clock. So if you have %m-%d the parser would detect
the missing year value and fill it in using the clock.
the missing year value and fill it in using the clock.
todo -- What to do with the %x. %x in the classic facet is just bad...
@@ -139,7 +152,7 @@ class format_date_parser
{
public:
typedef std::basic_string<charT> string_type;
typedef std::basic_ostringstream<charT> stringstream_type;
typedef std::basic_istringstream<charT> stringstream_type;
typedef std::istreambuf_iterator<charT> stream_itr_type;
typedef typename string_type::const_iterator const_itr;
typedef typename date_type::year_type year_type;
@@ -153,7 +166,7 @@ class format_date_parser
typedef std::vector<std::basic_string<charT> > input_collection_type;
// TODO sv_parser uses its default constructor - write the others
format_date_parser(const string_type& format_str,
const input_collection_type& month_short_names,
const input_collection_type& month_long_names,
@@ -165,7 +178,7 @@ class format_date_parser
m_weekday_short_names(weekday_short_names),
m_weekday_long_names(weekday_long_names)
{}
format_date_parser(const string_type& format_str,
const std::locale& locale) :
m_format(format_str),
@@ -183,7 +196,7 @@ class format_date_parser
this->m_weekday_short_names = fdp.m_weekday_short_names;
this->m_weekday_long_names = fdp.m_weekday_long_names;
}
string_type format() const
{
return m_format;
@@ -212,61 +225,60 @@ class format_date_parser
}
date_type
parse_date(const string_type& value,
parse_date(const string_type& value,
const string_type& format_str,
const special_values_parser<date_type,charT>& sv_parser) const
{
stringstream_type ss;
ss << value;
stringstream_type ss(value);
stream_itr_type sitr(ss);
stream_itr_type stream_end;
return parse_date(sitr, stream_end, format_str, sv_parser);
}
date_type
parse_date(std::istreambuf_iterator<charT>& sitr,
parse_date(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
const special_values_parser<date_type,charT>& sv_parser) const
{
return parse_date(sitr, stream_end, m_format, sv_parser);
}
/*! Of all the objects that the format_date_parser can parse, only a
* date can be a special value. Therefore, only parse_date checks
/*! Of all the objects that the format_date_parser can parse, only a
* date can be a special value. Therefore, only parse_date checks
* for special_values. */
date_type
parse_date(std::istreambuf_iterator<charT>& sitr,
parse_date(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
const special_values_parser<date_type,charT>& sv_parser) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
short year(0), month(0), day(0), day_of_year(0);// wkday(0);
/* Initialized the following to their minimum values. These intermediate
* objects are used so we get specific exceptions when part of the input
* is unparsable.
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
short year(0), month(0), day(0), day_of_year(0);// wkday(0);
/* Initialized the following to their minimum values. These intermediate
* objects are used so we get specific exceptions when part of the input
* is unparsable.
* Ex: "205-Jan-15" will throw a bad_year, "2005-Jsn-15"- bad_month, etc.*/
year_type t_year(1400);
month_type t_month(1);
day_type t_day(1);
day_of_week_type wkday(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
itr++;
if ( ++itr == format_str.end())
break;
if (*itr != '%') {
switch(*itr) {
case 'a':
case 'a':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
match_results mr = m_weekday_short_names.match(sitr, stream_end);
@@ -278,15 +290,14 @@ class format_date_parser
}
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'A':
case 'A':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
match_results mr = m_weekday_long_names.match(sitr, stream_end);
@@ -298,12 +309,11 @@ class format_date_parser
}
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'b':
case 'b':
{
match_results mr = m_month_short_names.match(sitr, stream_end);
if(mr.current_match == match_results::PARSE_ERROR) {
@@ -314,12 +324,11 @@ class format_date_parser
}
t_month = month_type(mr.current_match);
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'B':
case 'B':
{
match_results mr = m_month_long_names.match(sitr, stream_end);
if(mr.current_match == match_results::PARSE_ERROR) {
@@ -330,12 +339,11 @@ class format_date_parser
}
t_month = month_type(mr.current_match);
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'd':
case 'd':
{
match_results mr;
day = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -347,7 +355,7 @@ class format_date_parser
t_day = day_type(day);
break;
}
case 'e':
case 'e':
{
match_results mr;
day = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2, ' ');
@@ -359,7 +367,7 @@ class format_date_parser
t_day = day_type(day);
break;
}
case 'j':
case 'j':
{
match_results mr;
day_of_year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 3);
@@ -373,7 +381,7 @@ class format_date_parser
t_day_of_year = day_of_year_type(day_of_year);
break;
}
case 'm':
case 'm':
{
match_results mr;
month = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -385,7 +393,7 @@ class format_date_parser
t_month = month_type(month);
break;
}
case 'Y':
case 'Y':
{
match_results mr;
year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 4);
@@ -397,7 +405,7 @@ class format_date_parser
t_year = year_type(year);
break;
}
case 'y':
case 'y':
{
match_results mr;
year = fixed_string_to_int<short, charT>(sitr, stream_end, mr, 2);
@@ -412,139 +420,135 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
if (day_of_year > 0) {
date_type d(static_cast<unsigned short>(year-1),12,31); //end of prior year
return d + duration_type(day_of_year);
}
return date_type(t_year, t_month, t_day); // exceptions were thrown earlier
// if input was no good
return date_type(t_year, t_month, t_day); // exceptions were thrown earlier
// if input was no good
}
//! Throws bad_month if unable to parse
month_type
parse_month(std::istreambuf_iterator<charT>& sitr,
parse_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
match_results mr;
return parse_month(sitr, stream_end, format_str, mr);
}
//! Throws bad_month if unable to parse
month_type
parse_month(std::istreambuf_iterator<charT>& sitr,
parse_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
short month(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
itr++;
if ( ++itr == format_str.end())
break;
if (*itr != '%') {
switch(*itr) {
case 'b':
case 'b':
{
mr = m_month_short_names.match(sitr, stream_end);
month = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'B':
case 'B':
{
mr = m_month_long_names.match(sitr, stream_end);
month = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'm':
case 'm':
{
month = var_string_to_int<short, charT>(sitr, stream_end, 2);
// var_string_to_int returns -1 if parse failed. That will
// var_string_to_int returns -1 if parse failed. That will
// cause a bad_month exception to be thrown so we do nothing here
break;
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
return month_type(month); // throws bad_month exception when values are zero
}
//! Expects 1 or 2 digits 1-31. Throws bad_day_of_month if unable to parse
day_type
parse_var_day_of_month(std::istreambuf_iterator<charT>& sitr,
parse_var_day_of_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
return day_type(var_string_to_int<short, charT>(sitr, stream_end, 2));
}
//! Expects 2 digits 01-31. Throws bad_day_of_month if unable to parse
day_type
parse_day_of_month(std::istreambuf_iterator<charT>& sitr,
parse_day_of_month(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
//return day_type(var_string_to_int<short, charT>(sitr, stream_end, 2));
match_results mr;
@@ -552,7 +556,7 @@ class format_date_parser
}
day_of_week_type
parse_weekday(std::istreambuf_iterator<charT>& sitr,
parse_weekday(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
@@ -560,49 +564,47 @@ class format_date_parser
return parse_weekday(sitr, stream_end, format_str, mr);
}
day_of_week_type
parse_weekday(std::istreambuf_iterator<charT>& sitr,
parse_weekday(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
short wkday(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
itr++;
if ( ++itr == format_str.end())
break;
if (*itr != '%') {
switch(*itr) {
case 'a':
case 'a':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
mr = m_weekday_short_names.match(sitr, stream_end);
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
}
case 'A':
case 'A':
{
//this value is just throw away. It could be used for
//error checking potentially, but it isn't helpful in
//error checking potentially, but it isn't helpful in
//actually constructing the date - we just need to get it
//out of the stream
mr = m_weekday_long_names.match(sitr, stream_end);
wkday = mr.current_match;
if (mr.has_remaining()) {
current_char = mr.last_char();
use_current_char = true;
}
break;
@@ -615,35 +617,34 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
}
}
return day_of_week_type(wkday); // throws bad_day_of_month exception
return day_of_week_type(wkday); // throws bad_day_of_month exception
// when values are zero
}
//! throws bad_year if unable to parse
year_type
parse_year(std::istreambuf_iterator<charT>& sitr,
parse_year(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str) const
{
@@ -653,23 +654,21 @@ class format_date_parser
//! throws bad_year if unable to parse
year_type
parse_year(std::istreambuf_iterator<charT>& sitr,
parse_year(std::istreambuf_iterator<charT>& sitr,
std::istreambuf_iterator<charT>& stream_end,
string_type format_str,
match_results& mr) const
{
bool use_current_char = false;
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
charT current_char = *sitr;
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
unsigned short year(0);
const_itr itr(format_str.begin());
while (itr != format_str.end() && (sitr != stream_end)) {
if (*itr == '%') {
itr++;
if ( ++itr == format_str.end())
break;
if (*itr != '%') {
//match_results mr;
switch(*itr) {
@@ -688,32 +687,26 @@ class format_date_parser
}
default:
{} //ignore those we don't understand
}//switch
}
else { // itr == '%', second consecutive
sitr++;
}
itr++; //advance past format specifier
}
else { //skip past chars in format and in buffer
itr++;
if (use_current_char) {
use_current_char = false;
current_char = *sitr;
}
else {
sitr++;
}
sitr++;
}
}
return year_type(year); // throws bad_year exception when values are zero
}
private:
string_type m_format;
parse_tree_type m_month_short_names;
@@ -2,72 +2,67 @@
#define _GREGORIAN__CONVERSION_HPP___
/* Copyright (c) 2004-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <exception>
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/c_time.hpp"
#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
# if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS)
# include "boost/date_time/gregorian/formatters_limited.hpp"
# else
# include "boost/date_time/gregorian/formatters.hpp"
# endif // BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS
#else
# include <sstream>
# include "boost/date_time/gregorian/gregorian_io.hpp"
#endif // USE_DATE_TIME_PRE_1_33_FACET_IO
#include <cstring>
#include <string>
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
namespace boost {
namespace gregorian {
//! Converts a date to a tm struct. Throws out_of_range exception if date is a special value
inline
std::tm to_tm(const date& d)
std::tm to_tm(const date& d)
{
if(d.is_pos_infinity() || d.is_neg_infinity() || d.is_not_a_date()){
#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
std::string s("tm unable to handle date value of " + to_simple_string(d));
throw std::out_of_range(s);
#else
std::stringstream ss;
ss << "tm unable to handle date value of " << d;
throw std::out_of_range(ss.str());
#endif // USE_DATE_TIME_PRE_1_33_FACET_IO
if (d.is_special())
{
std::string s = "tm unable to handle ";
switch (d.as_special())
{
case date_time::not_a_date_time:
s += "not-a-date-time value"; break;
case date_time::neg_infin:
s += "-infinity date value"; break;
case date_time::pos_infin:
s += "+infinity date value"; break;
default:
s += "a special date value"; break;
}
boost::throw_exception(std::out_of_range(s));
}
std::tm datetm;
std::memset(&datetm, 0, sizeof(datetm));
boost::gregorian::date::ymd_type ymd = d.year_month_day();
datetm.tm_year = ymd.year-1900;
datetm.tm_mon = ymd.month-1;
datetm.tm_year = ymd.year - 1900;
datetm.tm_mon = ymd.month - 1;
datetm.tm_mday = ymd.day;
datetm.tm_wday = d.day_of_week();
datetm.tm_yday = d.day_of_year()-1;
datetm.tm_hour = datetm.tm_min = datetm.tm_sec = 0;
datetm.tm_yday = d.day_of_year() - 1;
datetm.tm_isdst = -1; // negative because not enough info to set tm_isdst
return datetm;
}
//! Converts a tm structure into a date dropping the any time values.
inline
date date_from_tm(const std::tm& datetm)
date date_from_tm(const std::tm& datetm)
{
return date(static_cast<unsigned short>(datetm.tm_year+1900),
static_cast<unsigned short>(datetm.tm_mon+1),
return date(static_cast<unsigned short>(datetm.tm_year+1900),
static_cast<unsigned short>(datetm.tm_mon+1),
static_cast<unsigned short>(datetm.tm_mday));
}
} } //namespace boost::gregorian
#endif
@@ -65,7 +65,7 @@ namespace gregorian {
std::basic_string<charT> s(date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.begin()));
return s + sep + date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.last());
}
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
//! Date period to ISO 8601 standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date_period& d) {
@@ -78,7 +78,7 @@ namespace gregorian {
inline std::basic_string<charT> to_iso_extended_string_type(const date& d) {
return date_time::date_formatter<date,date_time::iso_extended_format<charT>,charT>::date_to_string(d);
}
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
//! Convert to ISO 8601 extended format string CCYY-MM-DD. Example 2002-12-31
/*!\ingroup date_format
*/
inline std::string to_iso_extended_string(const date& d) {
@@ -90,7 +90,7 @@ namespace gregorian {
inline std::basic_string<charT> to_iso_string_type(const date& d) {
return date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d);
}
//! Convert to iso standard string YYYYMMDD. Example: 20021231
//! Convert to ISO 8601 standard string YYYYMMDD. Example: 20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date& d) {
@@ -35,7 +35,7 @@ namespace gregorian {
return std::string("[" + d1 + "/" + d2 + "]");
}
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
//! Date period to ISO 8601 standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date_period& d) {
@@ -44,14 +44,14 @@ namespace gregorian {
}
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
//! Convert to ISO 8601 extended format string CCYY-MM-DD. Example 2002-12-31
/*!\ingroup date_format
*/
inline std::string to_iso_extended_string(const date& d) {
return date_time::date_formatter<date,date_time::iso_extended_format<char> >::date_to_string(d);
}
//! Convert to iso standard string YYYYMMDD. Example: 20021231
//! Convert to ISO 8601 standard string YYYYMMDD. Example: 20021231
/*!\ingroup date_format
*/
inline std::string to_iso_string(const date& d) {
@@ -2,27 +2,29 @@
#define GREGORIAN_GREGORIAN_CALENDAR_HPP__
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
* Author: Jeff Garland
* $Date$
*/
#include "boost/date_time/gregorian/greg_weekday.hpp"
#include "boost/date_time/gregorian/greg_day_of_year.hpp"
#include "boost/date_time/gregorian_calendar.hpp"
#include "boost/date_time/gregorian/greg_ymd.hpp"
#include "boost/date_time/int_adapter.hpp"
#include <boost/cstdint.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/greg_weekday.hpp>
#include <boost/date_time/gregorian/greg_day_of_year.hpp>
#include <boost/date_time/gregorian_calendar.hpp>
#include <boost/date_time/gregorian/greg_ymd.hpp>
#include <boost/date_time/int_adapter.hpp>
namespace boost {
namespace gregorian {
//!An internal date representation that includes infinities, not a date
typedef date_time::int_adapter<unsigned long> fancy_date_rep;
typedef date_time::int_adapter<uint32_t> fancy_date_rep;
//! Gregorian calendar for this implementation, hard work in the base
class gregorian_calendar :
class BOOST_SYMBOL_VISIBLE gregorian_calendar :
public date_time::gregorian_calendar_base<greg_year_month_day, fancy_date_rep::int_type> {
public:
//! Type to hold a weekday (eg: Sunday, Monday,...)
@@ -34,14 +36,14 @@ namespace gregorian {
//! Date rep implements the traits stuff as well
typedef fancy_date_rep date_traits_type;
private:
};
} } //namespace gregorian
#endif
+51 -42
View File
@@ -1,18 +1,20 @@
#ifndef GREG_DATE_HPP___
#define GREG_DATE_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
* Author: Jeff Garland
* $Date$
*/
#include "boost/date_time/date.hpp"
#include "boost/date_time/special_defs.hpp"
#include "boost/date_time/gregorian/greg_calendar.hpp"
#include "boost/date_time/gregorian/greg_duration.hpp"
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/date.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/gregorian/greg_calendar.hpp>
#include <boost/date_time/gregorian/greg_duration.hpp>
namespace boost {
namespace gregorian {
@@ -27,13 +29,13 @@ namespace gregorian {
using date_time::min_date_time;
//! A date type based on gregorian_calendar
/*! This class is the primary interface for programming with
/*! This class is the primary interface for programming with
greogorian dates. The is a lightweight type that can be
freely passed by value. All comparison operators are
supported.
freely passed by value. All comparison operators are
supported.
\ingroup date_basics
*/
class date : public date_time::date<date, gregorian_calendar, date_duration>
class BOOST_SYMBOL_VISIBLE date : public date_time::date<date, gregorian_calendar, date_duration>
{
public:
typedef gregorian_calendar::year_type year_type;
@@ -46,86 +48,93 @@ namespace gregorian {
typedef date_duration duration_type;
#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR)
//! Default constructor constructs with not_a_date_time
date():
BOOST_CXX14_CONSTEXPR date():
date_time::date<date, gregorian_calendar, date_duration>(date_rep_type::from_special(not_a_date_time))
{}
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
//! Main constructor with year, month, day
date(year_type y, month_type m, day_type d)
BOOST_CXX14_CONSTEXPR date(year_type y, month_type m, day_type d)
: date_time::date<date, gregorian_calendar, date_duration>(y, m, d)
{
if (gregorian_calendar::end_of_month_day(y, m) < d) {
throw bad_day_of_month(std::string("Day of month is not valid for year"));
boost::throw_exception(bad_day_of_month(std::string("Day of month is not valid for year")));
}
}
//! Constructor from a ymd_type structure
explicit date(const ymd_type& ymd)
BOOST_CXX14_CONSTEXPR explicit date(const ymd_type& ymd)
: date_time::date<date, gregorian_calendar, date_duration>(ymd)
{}
//! Needed copy constructor
explicit date(const date_int_type& rhs):
BOOST_CXX14_CONSTEXPR explicit date(const date_int_type& rhs):
date_time::date<date,gregorian_calendar, date_duration>(rhs)
{}
//! Needed copy constructor
explicit date(date_rep_type rhs):
BOOST_CXX14_CONSTEXPR explicit date(date_rep_type rhs):
date_time::date<date,gregorian_calendar, date_duration>(rhs)
{}
//! Constructor for infinities, not a date, max and min date
explicit date(special_values sv):
date_time::date<date, gregorian_calendar, date_duration>(date_rep_type::from_special(sv))
{
if (sv == min_date_time)
{
*this = date(1400, 1, 1);
}
if (sv == max_date_time)
{
*this = date(9999, 12, 31);
}
}
BOOST_CXX14_CONSTEXPR explicit date(special_values sv):
date_time::date<date, gregorian_calendar, date_duration>(from_special_adjusted(sv))
{}
//!Return the Julian Day number for the date.
date_int_type julian_day() const
BOOST_CXX14_CONSTEXPR date_int_type julian_day() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::julian_day_number(ymd);
}
//!Return the day of year 1..365 or 1..366 (for leap year)
day_of_year_type day_of_year() const
BOOST_CXX14_CONSTEXPR day_of_year_type day_of_year() const
{
date start_of_year(year(), 1, 1);
unsigned short doy = static_cast<unsigned short>((*this-start_of_year).days() + 1);
return day_of_year_type(doy);
}
//!Return the Modified Julian Day number for the date.
long modjulian_day() const
BOOST_CXX14_CONSTEXPR date_int_type modjulian_day() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::modjulian_day_number(ymd);
return gregorian_calendar::modjulian_day_number(ymd);
}
//!Return the iso 8601 week number 1..53
int week_number() const
//!Return the ISO 8601 week number 1..53
BOOST_CXX14_CONSTEXPR int week_number() const
{
ymd_type ymd = year_month_day();
return gregorian_calendar::week_number(ymd);
return gregorian_calendar::week_number(ymd);
}
//! Return the day number from the calendar
date_int_type day_number() const
BOOST_CXX14_CONSTEXPR date_int_type day_number() const
{
return days_;
}
//! Return the last day of the current month
date end_of_month() const
BOOST_CXX14_CONSTEXPR date end_of_month() const
{
ymd_type ymd = year_month_day();
short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
ymd_type ymd = year_month_day();
unsigned short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
return date(ymd.year, ymd.month, eom_day);
}
friend BOOST_CXX14_CONSTEXPR
bool operator==(const date& lhs, const date& rhs);
private:
BOOST_CXX14_CONSTEXPR date_rep_type from_special_adjusted(special_values sv)
{
switch (sv)
{
case min_date_time: return gregorian_calendar::day_number(ymd_type(1400, 1, 1));
case max_date_time: return gregorian_calendar::day_number(ymd_type(9999, 12, 31));
default: return date_rep_type::from_special(sv);
}
}
};
inline BOOST_CXX14_CONSTEXPR
bool operator==(const date& lhs, const date& rhs)
{
return lhs.days_ == rhs.days_;
}
} } //namespace gregorian
@@ -1,7 +1,7 @@
#ifndef GREG_DAY_HPP___
#define GREG_DAY_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003,2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,7 +9,8 @@
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <stdexcept>
#include <string>
@@ -17,7 +18,7 @@ namespace boost {
namespace gregorian {
//! Exception type for gregorian day of month (1..31)
struct bad_day_of_month : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_day_of_month : public std::out_of_range
{
bad_day_of_month() :
std::out_of_range(std::string("Day of month value is out of range 1..31"))
@@ -39,11 +40,11 @@ namespace gregorian {
is automatically range checked so values outside of the range 1-31
will cause a bad_day_of_month exception
*/
class greg_day : public greg_day_rep {
class BOOST_SYMBOL_VISIBLE greg_day : public greg_day_rep {
public:
greg_day(unsigned short day_of_month) : greg_day_rep(day_of_month) {}
unsigned short as_number() const {return value_;}
operator unsigned short() const {return value_;}
BOOST_CXX14_CONSTEXPR greg_day(value_type day_of_month) : greg_day_rep(day_of_month) {}
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
private:
};
@@ -9,7 +9,8 @@
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <stdexcept>
#include <string>
@@ -17,7 +18,7 @@ namespace boost {
namespace gregorian {
//! Exception type for day of year (1..366)
struct bad_day_of_year : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_day_of_year : public std::out_of_range
{
bad_day_of_year() :
std::out_of_range(std::string("Day of year value is out of range 1..366"))
@@ -1,7 +1,7 @@
#ifndef GREG_DURATION_HPP___
#define GREG_DURATION_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,30 +9,139 @@
* $Date$
*/
#include "boost/date_time/date_duration.hpp"
#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES)
#include "boost/date_time/date_duration_types.hpp"
#endif
#include "boost/date_time/int_adapter.hpp"
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/date_duration.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/special_defs.hpp>
namespace boost {
namespace gregorian {
//!An internal date representation that includes infinities, not a date
typedef boost::date_time::duration_traits_adapted date_duration_rep;
//! Durations in days for gregorian system
/*! \ingroup date_basics
*/
typedef date_time::date_duration<date_duration_rep> date_duration;
class BOOST_SYMBOL_VISIBLE date_duration :
public boost::date_time::date_duration< date_duration_rep >
{
typedef boost::date_time::date_duration< date_duration_rep > base_type;
public:
typedef base_type::duration_rep duration_rep;
//! Construct from a day count
BOOST_CXX14_CONSTEXPR explicit
date_duration(duration_rep day_count = 0) : base_type(day_count) {}
//! construct from special_values
BOOST_CXX14_CONSTEXPR
date_duration(date_time::special_values sv) : base_type(sv) {}
//! Construct from another date_duration
BOOST_CXX14_CONSTEXPR
date_duration(const base_type& other) : base_type(other)
{}
// Relational operators
// NOTE: Because of date_time::date_duration< T > design choice we don't use Boost.Operators here,
// because we need the class to be a direct base. Either lose EBO, or define operators by hand.
// The latter is more effecient.
BOOST_CXX14_CONSTEXPR bool operator== (const date_duration& rhs) const
{
return base_type::operator== (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator!= (const date_duration& rhs) const
{
return !operator== (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator< (const date_duration& rhs) const
{
return base_type::operator< (rhs);
}
BOOST_CXX14_CONSTEXPR bool operator> (const date_duration& rhs) const
{
return !(base_type::operator< (rhs) || base_type::operator== (rhs));
}
BOOST_CXX14_CONSTEXPR bool operator<= (const date_duration& rhs) const
{
return (base_type::operator< (rhs) || base_type::operator== (rhs));
}
BOOST_CXX14_CONSTEXPR bool operator>= (const date_duration& rhs) const
{
return !base_type::operator< (rhs);
}
//! Subtract another duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator-= (const date_duration& rhs)
{
base_type::operator-= (rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR friend
date_duration operator- (date_duration rhs, date_duration const& lhs);
//! Add a duration -- result is signed
BOOST_CXX14_CONSTEXPR date_duration& operator+= (const date_duration& rhs)
{
base_type::operator+= (rhs);
return *this;
}
BOOST_CXX14_CONSTEXPR friend
date_duration operator+ (date_duration rhs, date_duration const& lhs);
//! unary- Allows for dd = -date_duration(2); -> dd == -2
BOOST_CXX14_CONSTEXPR date_duration operator- ()const
{
return date_duration(get_rep() * (-1));
}
//! Division operations on a duration with an integer.
BOOST_CXX14_CONSTEXPR date_duration& operator/= (int divisor)
{
base_type::operator/= (divisor);
return *this;
}
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs);
//! Returns the smallest duration -- used by to calculate 'end'
static BOOST_CXX14_CONSTEXPR date_duration unit()
{
return date_duration(base_type::unit().get_rep());
}
};
inline BOOST_CXX14_CONSTEXPR
date_duration operator- (date_duration rhs, date_duration const& lhs)
{
rhs -= lhs;
return rhs;
}
inline BOOST_CXX14_CONSTEXPR
date_duration operator+ (date_duration rhs, date_duration const& lhs)
{
rhs += lhs;
return rhs;
}
inline BOOST_CXX14_CONSTEXPR date_duration operator/ (date_duration rhs, int lhs)
{
rhs /= lhs;
return rhs;
}
//! Shorthand for date_duration
typedef date_duration days;
} } //namespace gregorian
#if defined(BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES)
#include <boost/date_time/date_duration_types.hpp>
#endif
#endif
@@ -1,6 +1,6 @@
#ifndef GREG_DURATION_TYPES_HPP___
#define GREG_DURATION_TYPES_HPP___
/* Copyright (c) 2004 CrystalClear Software, Inc.
* Subject to Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,17 +9,18 @@
*/
#include "boost/date_time/gregorian/greg_date.hpp"
#include "boost/date_time/int_adapter.hpp"
#include "boost/date_time/adjust_functors.hpp"
#include "boost/date_time/date_duration.hpp"
#include "boost/date_time/date_duration_types.hpp"
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/greg_date.hpp>
#include <boost/date_time/int_adapter.hpp>
#include <boost/date_time/adjust_functors.hpp>
#include <boost/date_time/date_duration_types.hpp>
#include <boost/date_time/gregorian/greg_duration.hpp>
namespace boost {
namespace gregorian {
//! config struct for additional duration types (ie months_duration<> & years_duration<>)
struct greg_durations_config {
struct BOOST_SYMBOL_VISIBLE greg_durations_config {
typedef date date_type;
typedef date_time::int_adapter<int> int_rep;
typedef date_time::month_functor<date_type> month_adjustor_type;
@@ -27,7 +28,16 @@ namespace gregorian {
typedef date_time::months_duration<greg_durations_config> months;
typedef date_time::years_duration<greg_durations_config> years;
typedef date_time::weeks_duration<date_time::duration_traits_adapted> weeks;
class BOOST_SYMBOL_VISIBLE weeks_duration : public date_duration {
public:
BOOST_CXX14_CONSTEXPR weeks_duration(duration_rep w)
: date_duration(w * 7) {}
BOOST_CXX14_CONSTEXPR weeks_duration(date_time::special_values sv)
: date_duration(sv) {}
};
typedef weeks_duration weeks;
}} // namespace boost::gregorian
@@ -9,21 +9,26 @@
* $Date$
*/
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/date_formatting_locales.hpp" // sets BOOST_DATE_TIME_NO_LOCALE
#include "boost/date_time/gregorian/parsers.hpp"
#include <string>
#include <exception>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/date_formatting_locales.hpp> // sets BOOST_DATE_TIME_NO_LOCALE
#include <boost/date_time/gregorian/parsers.hpp>
#include <boost/io/ios_state.hpp>
//This file is basically commented out if locales are not supported
#ifndef BOOST_DATE_TIME_NO_LOCALE
#include <string>
#include <memory>
#include <locale>
#include <iostream>
#include <exception>
namespace boost {
namespace gregorian {
//! Configuration of the output facet template
struct greg_facet_config
struct BOOST_SYMBOL_VISIBLE greg_facet_config
{
typedef boost::gregorian::greg_month month_type;
typedef boost::date_time::special_values special_value_enum;
@@ -71,9 +76,9 @@ namespace gregorian {
greg_month_formatter::format_month(m, os, f);
}
else { //default to numeric
charT fill_char = '0';
os << std::setw(2) << std::setfill(fill_char) << m.as_number();
else { // default to numeric
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << m.as_number();
}
return os;
@@ -94,7 +99,7 @@ namespace gregorian {
std::locale locale = os.getloc();
if (std::has_facet<facet_def>(locale)) {
const facet_def& f = std::use_facet<facet_def>(locale);
greg_weekday_formatter::format_weekday(wd.as_enum(), os, f, true);
greg_weekday_formatter::format_weekday(wd, os, f, true);
}
else { //default to short English string eg: Sun, Mon, Tue, Wed...
os << wd.as_short_string();
@@ -138,7 +143,8 @@ namespace gregorian {
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const partial_date& pd)
{
os << std::setw(2) << std::setfill('0') << pd.day() << ' '
boost::io::basic_ios_fill_saver<charT> ifs(os);
os << std::setw(2) << std::setfill(os.widen('0')) << pd.day() << ' '
<< pd.month().as_short_string() ;
return os;
}
@@ -211,8 +217,6 @@ namespace gregorian {
std::basic_istream<charT>& operator>>(std::basic_istream<charT>& is, date& d)
{
std::istream_iterator<std::basic_string<charT>, charT> beg(is), eos;
typedef boost::date_time::all_date_names_put<greg_facet_config, charT> facet_def;
d = from_stream(beg, eos);
return is;
}
@@ -281,22 +285,32 @@ namespace gregorian {
const facet_def& f = std::use_facet<facet_def>(is.getloc());
num = date_time::find_match(f.get_short_month_names(),
f.get_long_month_names(),
(greg_month::max)(), s);
(greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size,
// which is needed by find_match
}
/* bad_cast will be thrown if the desired facet is not accessible
* so we can generate the facet. This has the drawback of using english
* names as a default. */
catch(std::bad_cast bc){
std::cout << "Month exception caught" << std::endl;
catch(std::bad_cast&){
charT a = '\0';
const facet_def* f = create_facet_def(a);
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr< const facet_def > f(create_facet_def(a));
#else
std::unique_ptr< const facet_def > f(create_facet_def(a));
#endif
num = date_time::find_match(f->get_short_month_names(),
f->get_long_month_names(),
(greg_month::max)(), s);
delete(f);
(greg_month::max)(), s); // greg_month spans 1..12, so max returns the array size,
// which is needed by find_match
}
num += 1; // months numbered 1-12
++num; // months numbered 1-12
m = greg_month(num);
return is;
@@ -323,19 +337,29 @@ namespace gregorian {
const facet_def& f = std::use_facet<facet_def>(is.getloc());
num = date_time::find_match(f.get_short_weekday_names(),
f.get_long_weekday_names(),
(greg_weekday::max)(), s);
(greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed
// to form the array size which is needed by find_match
}
/* bad_cast will be thrown if the desired facet is not accessible
* so we can generate the facet. This has the drawback of using english
* names as a default. */
catch(std::bad_cast bc){
//std::cout << "Weekday exception caught" << std::endl;
catch(std::bad_cast&){
charT a = '\0';
const facet_def* f = create_facet_def(a);
#if defined(BOOST_NO_CXX11_SMART_PTR)
std::auto_ptr< const facet_def > f(create_facet_def(a));
#else
std::unique_ptr< const facet_def > f(create_facet_def(a));
#endif
num = date_time::find_match(f->get_short_weekday_names(),
f->get_long_weekday_names(),
(greg_weekday::max)(), s);
delete(f);
(greg_weekday::max)() + 1, s); // greg_weekday spans 0..6, so increment is needed
// to form the array size which is needed by find_match
}
wd = greg_weekday(num); // weekdays numbered 0-6
@@ -344,8 +368,7 @@ namespace gregorian {
} } //namespace gregorian
#endif
#endif
#endif
@@ -1,7 +1,7 @@
#ifndef GREG_MONTH_HPP___
#define GREG_MONTH_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,15 +9,11 @@
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <stdexcept>
#include <string>
#include <map>
#include <algorithm>
#include <cctype>
namespace boost {
namespace gregorian {
@@ -39,9 +35,9 @@ namespace gregorian {
using date_time::Dec;
using date_time::NotAMonth;
using date_time::NumMonths;
//! Exception thrown if a greg_month is constructed with a value out of range
struct bad_month : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_month : public std::out_of_range
{
bad_month() : std::out_of_range(std::string("Month number is out of range 1..12")) {}
};
@@ -50,31 +46,65 @@ namespace gregorian {
//! A constrained range that implements the gregorian_month rules
typedef CV::constrained_value<greg_month_policies> greg_month_rep;
//! Wrapper class to represent months in gregorian based calendar
class BOOST_DATE_TIME_DECL greg_month : public greg_month_rep {
class BOOST_SYMBOL_VISIBLE greg_month : public greg_month_rep {
public:
typedef date_time::months_of_year month_enum;
typedef std::map<std::string, unsigned short> month_map_type;
typedef boost::shared_ptr<month_map_type> month_map_ptr_type;
//! Construct a month from the months_of_year enumeration
greg_month(month_enum theMonth) :
BOOST_CXX14_CONSTEXPR greg_month(month_enum theMonth) :
greg_month_rep(static_cast<greg_month_rep::value_type>(theMonth)) {}
//! Construct from a short value
greg_month(unsigned short theMonth) : greg_month_rep(theMonth) {}
BOOST_CXX14_CONSTEXPR greg_month(value_type theMonth) : greg_month_rep(theMonth) {}
//! Convert the value back to a short
operator unsigned short() const {return value_;}
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
//! Returns month as number from 1 to 12
unsigned short as_number() const {return value_;}
month_enum as_enum() const {return static_cast<month_enum>(value_);}
const char* as_short_string() const;
const char* as_long_string() const;
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR month_enum as_enum() const {return static_cast<month_enum>(value_);}
//! Returns 3 char english string for the month ex: Jan, Feb, Mar, Apr
const char*
as_short_string() const
{
static const char* const short_month_names[NumMonths]
= {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec", "NAM"};
return short_month_names[value_-1];
}
//! Returns full name of month as string in english ex: January, February
const char*
as_long_string() const
{
static const char* const long_month_names[NumMonths]
= {"January","February","March","April","May","June","July","August",
"September","October","November","December","NotAMonth"};
return long_month_names[value_-1];
}
#ifndef BOOST_NO_STD_WSTRING
const wchar_t* as_short_wstring() const;
const wchar_t* as_long_wstring() const;
//! Returns 3 wchar_t english string for the month ex: Jan, Feb, Mar, Apr
const wchar_t*
as_short_wstring() const
{
static const wchar_t* const w_short_month_names[NumMonths]
= {L"Jan",L"Feb",L"Mar",L"Apr",L"May",L"Jun",L"Jul",L"Aug",L"Sep",L"Oct",
L"Nov",L"Dec",L"NAM"};
return w_short_month_names[value_-1];
}
//! Returns full name of month as wchar_t string in english ex: January, February
const wchar_t*
as_long_wstring() const
{
static const wchar_t* const w_long_month_names[NumMonths]
= {L"January",L"February",L"March",L"April",L"May",L"June",L"July",L"August",
L"September",L"October",L"November",L"December",L"NotAMonth"};
return w_long_month_names[value_-1];
}
#endif // BOOST_NO_STD_WSTRING
//! Shared pointer to a map of Month strings (Names & Abbrev) & numbers
static month_map_ptr_type get_month_map_ptr();
/* parameterized as_*_string functions are intended to be called
* from a template function: "... as_short_string(charT c='\0');" */
@@ -100,6 +130,4 @@ namespace gregorian {
} } //namespace gregorian
#endif
@@ -11,38 +11,47 @@
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/gregorian/parsers.hpp"
#include "boost/serialization/split_free.hpp"
#include "boost/core/nvp.hpp"
// macros to split serialize functions into save & load functions
// An expanded version is below for gregorian::date
// NOTE: these macros define template functions in the boost::serialization namespace.
// They must be expanded *outside* of any namespace
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::date_period)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_day)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::greg_weekday)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::partial_date)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::nth_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::last_kday_of_month)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_before)
BOOST_SERIALIZATION_SPLIT_FREE(::boost::gregorian::first_kday_after)
namespace boost {
namespace gregorian {
std::string to_iso_string(const date&);
}
namespace serialization {
// A macro to split serialize functions into save & load functions.
// It is here to avoid dependency on Boost.Serialization just for the
// BOOST_SERIALIZATION_SPLIT_FREE macro
#define BOOST_DATE_TIME_SPLIT_FREE(T) \
template<class Archive> \
inline void serialize(Archive & ar, \
T & t, \
const unsigned int file_version) \
{ \
split_free(ar, t, file_version); \
}
/*! Method that does serialization for gregorian::date -- splits to load/save
*/
template<class Archive>
inline void serialize(Archive & ar,
::boost::gregorian::date & d,
const unsigned int file_version)
{
split_free(ar, d, file_version);
}
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_duration)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_duration::duration_rep)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::date_period)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_year)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_day)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::greg_weekday)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::partial_date)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::nth_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::last_kday_of_month)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_before)
BOOST_DATE_TIME_SPLIT_FREE(::boost::gregorian::first_kday_after)
#undef BOOST_DATE_TIME_SPLIT_FREE
//! Function to save gregorian::date objects using serialization lib
/*! Dates are serialized into a string for transport and storage.
@@ -72,10 +81,10 @@ void load(Archive & ar,
ar & make_nvp("date", ds);
try{
d = ::boost::gregorian::from_undelimited_string(ds);
}catch(bad_lexical_cast be) {
}catch(bad_lexical_cast&) {
gregorian::special_values sv = gregorian::special_value_from_string(ds);
if(sv == gregorian::not_special) {
throw(be); // no match found, rethrow original exception
throw; // no match found, rethrow original exception
}
else {
d = gregorian::date(sv);
@@ -86,7 +95,7 @@ void load(Archive & ar,
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
::boost::gregorian::date* dp,
const unsigned int /*file_version*/)
{
@@ -115,7 +124,7 @@ void load(Archive & ar, gregorian::date_duration & dd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::date_duration* dd,
inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration* dd,
const unsigned int /*file_version*/)
{
::new(dd) gregorian::date_duration(gregorian::not_a_date_time);
@@ -141,7 +150,7 @@ void load(Archive & ar, gregorian::date_duration::duration_rep & dr, unsigned in
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::date_duration::duration_rep* dr,
inline void load_construct_data(Archive & /*ar*/, gregorian::date_duration::duration_rep* dr,
const unsigned int /*file_version*/)
{
::new(dr) gregorian::date_duration::duration_rep(0);
@@ -177,7 +186,7 @@ void load(Archive & ar, gregorian::date_period& dp, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::date_period* dp,
inline void load_construct_data(Archive & /*ar*/, gregorian::date_period* dp,
const unsigned int /*file_version*/)
{
gregorian::date d(gregorian::not_a_date_time);
@@ -185,6 +194,32 @@ inline void load_construct_data(Archive & ar, gregorian::date_period* dp,
::new(dp) gregorian::date_period(d,dd);
}
/**** greg_year ****/
//! Function to save gregorian::greg_year objects using serialization lib
template<class Archive>
void save(Archive & ar, const gregorian::greg_year& gy,
unsigned int /*version*/)
{
unsigned short us = gy;
ar & make_nvp("greg_year", us);
}
//! Function to load gregorian::greg_year objects using serialization lib
template<class Archive>
void load(Archive & ar, gregorian::greg_year& gy, unsigned int /*version*/)
{
unsigned short us;
ar & make_nvp("greg_year", us);
gy = gregorian::greg_year(us);
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_year* gy,
const unsigned int /*file_version*/)
{
::new(gy) gregorian::greg_year(1900);
}
/**** greg_month ****/
//! Function to save gregorian::greg_month objects using serialization lib
@@ -205,7 +240,7 @@ void load(Archive & ar, gregorian::greg_month& gm, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::greg_month* gm,
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_month* gm,
const unsigned int /*file_version*/)
{
::new(gm) gregorian::greg_month(1);
@@ -231,7 +266,7 @@ void load(Archive & ar, gregorian::greg_day& gd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::greg_day* gd,
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_day* gd,
const unsigned int /*file_version*/)
{
::new(gd) gregorian::greg_day(1);
@@ -257,7 +292,7 @@ void load(Archive & ar, gregorian::greg_weekday& gd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::greg_weekday* gd,
inline void load_construct_data(Archive & /*ar*/, gregorian::greg_weekday* gd,
const unsigned int /*file_version*/)
{
::new(gd) gregorian::greg_weekday(1);
@@ -295,7 +330,7 @@ void load(Archive & ar, gregorian::partial_date& pd, unsigned int /*version*/)
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar, gregorian::partial_date* pd,
inline void load_construct_data(Archive & /*ar*/, gregorian::partial_date* pd,
const unsigned int /*file_version*/)
{
gregorian::greg_month gm(1);
@@ -338,7 +373,7 @@ void load(Archive & ar, gregorian::nth_kday_of_month& nkd, unsigned int /*versio
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
gregorian::nth_kday_of_month* nkd,
const unsigned int /*file_version*/)
{
@@ -378,7 +413,7 @@ void load(Archive & ar, gregorian::first_kday_of_month& fkd, unsigned int /*vers
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
gregorian::first_kday_of_month* fkd,
const unsigned int /*file_version*/)
{
@@ -417,7 +452,7 @@ void load(Archive & ar, gregorian::last_kday_of_month& lkd, unsigned int /*versi
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
gregorian::last_kday_of_month* lkd,
const unsigned int /*file_version*/)
{
@@ -446,7 +481,7 @@ void load(Archive & ar, gregorian::first_kday_before& fkdb, unsigned int /*versi
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
gregorian::first_kday_before* fkdb,
const unsigned int /*file_version*/)
{
@@ -475,7 +510,7 @@ void load(Archive & ar, gregorian::first_kday_after& fkda, unsigned int /*versio
}
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
gregorian::first_kday_after* fkda,
const unsigned int /*file_version*/)
{
@@ -1,7 +1,7 @@
#ifndef GREG_WEEKDAY_HPP___
#define GREG_WEEKDAY_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003,2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,9 +9,9 @@
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include "boost/date_time/date_defs.hpp"
#include "boost/date_time/compiler_config.hpp"
#include <boost/date_time/constrained_value.hpp>
#include <boost/date_time/date_defs.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <stdexcept>
#include <string>
@@ -29,30 +29,64 @@ namespace gregorian {
//! Exception that flags that a weekday number is incorrect
struct bad_weekday : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_weekday : public std::out_of_range
{
bad_weekday() : std::out_of_range(std::string("Weekday os out of range 0..6")) {}
bad_weekday() : std::out_of_range(std::string("Weekday is out of range 0..6")) {}
};
typedef CV::simple_exception_policy<unsigned short, 0, 6, bad_weekday> greg_weekday_policies;
typedef CV::constrained_value<greg_weekday_policies> greg_weekday_rep;
//! Represent a day within a week (range 0==Sun to 6==Sat)
class BOOST_DATE_TIME_DECL greg_weekday : public greg_weekday_rep {
class BOOST_SYMBOL_VISIBLE greg_weekday : public greg_weekday_rep {
public:
typedef boost::date_time::weekdays weekday_enum;
greg_weekday(unsigned short day_of_week_num) :
BOOST_CXX14_CONSTEXPR greg_weekday(value_type day_of_week_num) :
greg_weekday_rep(day_of_week_num)
{}
unsigned short as_number() const {return value_;}
const char* as_short_string() const;
const char* as_long_string() const;
BOOST_CXX14_CONSTEXPR value_type as_number() const {return value_;}
BOOST_CXX14_CONSTEXPR weekday_enum as_enum() const {return static_cast<weekday_enum>(value_);}
//! Return a 3 digit english string of the day of week (eg: Sun)
const char* as_short_string() const
{
static const char* const short_weekday_names[]
= {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
return short_weekday_names[value_];
}
//! Return a point to a long english string representing day of week
const char* as_long_string() const
{
static const char* const long_weekday_names[]
= {"Sunday","Monday","Tuesday","Wednesday", "Thursday", "Friday", "Saturday"};
return long_weekday_names[value_];
}
#ifndef BOOST_NO_STD_WSTRING
const wchar_t* as_short_wstring() const;
const wchar_t* as_long_wstring() const;
//! Return a 3 digit english wchar_t string of the day of week (eg: Sun)
const wchar_t* as_short_wstring() const
{
static const wchar_t* const w_short_weekday_names[]={L"Sun", L"Mon", L"Tue",
L"Wed", L"Thu", L"Fri", L"Sat"};
return w_short_weekday_names[value_];
}
//! Return a point to a long english wchar_t string representing day of week
const wchar_t* as_long_wstring() const
{
static const wchar_t* const w_long_weekday_names[]= {L"Sunday",L"Monday",L"Tuesday",
L"Wednesday", L"Thursday",
L"Friday", L"Saturday"};
return w_long_weekday_names[value_];
}
#endif // BOOST_NO_STD_WSTRING
weekday_enum as_enum() const {return static_cast<weekday_enum>(value_);}
};
+11 -12
View File
@@ -1,7 +1,7 @@
#ifndef GREG_YEAR_HPP___
#define GREG_YEAR_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,7 +9,8 @@
* $Date$
*/
#include "boost/date_time/constrained_value.hpp"
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/constrained_value.hpp>
#include <stdexcept>
#include <string>
@@ -17,31 +18,29 @@ namespace boost {
namespace gregorian {
//! Exception type for gregorian year
struct bad_year : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_year : public std::out_of_range
{
bad_year() :
std::out_of_range(std::string("Year is out of valid range: 1400..10000"))
std::out_of_range(std::string("Year is out of valid range: 1400..9999"))
{}
};
//! Policy class that declares error handling gregorian year type
typedef CV::simple_exception_policy<unsigned short, 1400, 10000, bad_year> greg_year_policies;
typedef CV::simple_exception_policy<unsigned short, 1400, 9999, bad_year> greg_year_policies;
//! Generated representation for gregorian year
typedef CV::constrained_value<greg_year_policies> greg_year_rep;
//! Represent a day of the month (range 1900 - 10000)
//! Represent a year (range 1400 - 9999)
/*! This small class allows for simple conversion an integer value into
a year for the gregorian calendar. This currently only allows a
range of 1900 to 10000. Both ends of the range are a bit arbitrary
range of 1400 to 9999. Both ends of the range are a bit arbitrary
at the moment, but they are the limits of current testing of the
library. As such they may be increased in the future.
*/
class greg_year : public greg_year_rep {
class BOOST_SYMBOL_VISIBLE greg_year : public greg_year_rep {
public:
greg_year(unsigned short year) : greg_year_rep(year) {}
operator unsigned short() const {return value_;}
private:
BOOST_CXX14_CONSTEXPR greg_year(value_type year) : greg_year_rep(year) {}
BOOST_CXX14_CONSTEXPR operator value_type() const {return value_;}
};
@@ -9,10 +9,17 @@
* $Date$
*/
#include "boost/date_time/date_facet.hpp"
#include "boost/io/ios_state.hpp"
#include <iostream>
#include <locale>
#include <iostream>
#include <iterator> // i/ostreambuf_iterator
#include <boost/io/ios_state.hpp>
#include <boost/date_time/date_facet.hpp>
#include <boost/date_time/period_parser.hpp>
#include <boost/date_time/period_formatter.hpp>
#include <boost/date_time/special_values_parser.hpp>
#include <boost/date_time/special_values_formatter.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/gregorian/conversion.hpp> // to_tm will be needed in the facets
namespace boost {
namespace gregorian {
@@ -70,14 +77,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, d);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, d);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, d);
@@ -131,14 +138,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dd);
@@ -195,14 +202,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, dp);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, dp);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, dp);
@@ -254,14 +261,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, m);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, m);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, m);
@@ -311,14 +318,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, wd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, wd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, wd);
@@ -352,14 +359,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gd);
@@ -393,14 +400,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, gy);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, gy);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, gy);
@@ -451,14 +458,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, pd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, pd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, pd);
@@ -508,14 +515,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, nday);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, nday);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, nday);
@@ -566,14 +573,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkd);
@@ -624,14 +631,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, lkd);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, lkd);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, lkd);
@@ -683,14 +690,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fka);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fka);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fka);
@@ -742,14 +749,14 @@ namespace gregorian {
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::date_input_facet<date, CharT> date_input_facet;
typedef typename date_time::date_input_facet<date, CharT> date_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<date_input_facet>(is.getloc())) {
std::use_facet<date_input_facet>(is.getloc()).get(sit, str_end, is, fkb);
if(std::has_facet<date_input_facet_local>(is.getloc())) {
std::use_facet<date_input_facet_local>(is.getloc()).get(sit, str_end, is, fkb);
}
else {
date_input_facet* f = new date_input_facet();
date_input_facet_local* f = new date_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, fkb);
+34 -15
View File
@@ -9,48 +9,67 @@
* $Date$
*/
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/date_parsing.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/parse_format_base.hpp"
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/date_parsing.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/parse_format_base.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/find_match.hpp>
#include <string>
#include <sstream>
#include <iterator>
namespace boost {
namespace gregorian {
//! Return special_value from string argument
/*! Return special_value from string argument. If argument is
* not one of the special value names (defined in src/gregorian/names.hpp),
/*! Return special_value from string argument. If argument is
* not one of the special value names (defined in names.hpp),
* return 'not_special' */
BOOST_DATE_TIME_DECL special_values special_value_from_string(const std::string& s);
inline
date_time::special_values
special_value_from_string(const std::string& s) {
static const char* const special_value_names[date_time::NumSpecialValues]
= {"not-a-date-time","-infinity","+infinity","min_date_time",
"max_date_time","not_special"};
short i = date_time::find_match(special_value_names,
special_value_names,
date_time::NumSpecialValues,
s);
if(i >= date_time::NumSpecialValues) { // match not found
return date_time::not_special;
}
else {
return static_cast<date_time::special_values>(i);
}
}
//! Deprecated: Use from_simple_string
inline date from_string(std::string s) {
inline date from_string(const std::string& s) {
return date_time::parse_date<date>(s);
}
//! From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted)
inline date from_simple_string(std::string s) {
inline date from_simple_string(const std::string& s) {
return date_time::parse_date<date>(s, date_time::ymd_order_iso);
}
//! From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted)
inline date from_us_string(std::string s) {
inline date from_us_string(const std::string& s) {
return date_time::parse_date<date>(s, date_time::ymd_order_us);
}
//! From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted)
inline date from_uk_string(std::string s) {
inline date from_uk_string(const std::string& s) {
return date_time::parse_date<date>(s, date_time::ymd_order_dmy);
}
//! From iso type date string where with order year-month-day eg: 20020125
inline date from_undelimited_string(std::string s) {
//! From ISO 8601 type date string where with order year-month-day eg: 20020125
inline date from_undelimited_string(const std::string& s) {
return date_time::parse_undelimited_date<date>(s);
}
//! From iso type date string where with order year-month-day eg: 20020125
//! From ISO 8601 type date string where with order year-month-day eg: 20020125
inline date date_from_iso_string(const std::string& s) {
return date_time::parse_undelimited_date<date>(s);
}
+22 -23
View File
@@ -2,13 +2,14 @@
#define DATE_TIME_GREGORIAN_CALENDAR_HPP__
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland
* Author: Jeff Garland
* $Date$
*/
#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace date_time {
@@ -19,15 +20,15 @@ namespace date_time {
can be used in the creation of date systems or just to perform calculations.
All the methods of this class are static functions, so the intent is to
never create instances of this class.
@param ymd_type_ Struct type representing the year, month, day. The ymd_type must
@tparam ymd_type_ Struct type representing the year, month, day. The ymd_type must
define a of types for the year, month, and day. These types need to be
arithmetic types.
@param date_int_type_ Underlying type for the date count. Must be an arithmetic type.
@tparam date_int_type_ Underlying type for the date count. Must be an arithmetic type.
*/
template<typename ymd_type_, typename date_int_type_>
class gregorian_calendar_base {
class BOOST_SYMBOL_VISIBLE gregorian_calendar_base {
public:
//! define a type a date split into components
//! define a type a date split into components
typedef ymd_type_ ymd_type;
//! define a type for representing months
typedef typename ymd_type::month_type month_type;
@@ -39,32 +40,30 @@ namespace date_time {
typedef date_int_type_ date_int_type;
static unsigned short day_of_week(const ymd_type& ymd);
static int week_number(const ymd_type&ymd);
//static unsigned short day_of_year(date_int_type);
static date_int_type day_number(const ymd_type& ymd);
static date_int_type julian_day_number(const ymd_type& ymd);
static long modjulian_day_number(const ymd_type& ymd);
static ymd_type from_day_number(date_int_type);
static ymd_type from_julian_day_number(date_int_type);
static ymd_type from_modjulian_day_number(long);
static bool is_leap_year(year_type);
static unsigned short end_of_month_day(year_type y, month_type m);
static ymd_type epoch();
static unsigned short days_in_week();
static BOOST_CXX14_CONSTEXPR unsigned short day_of_week(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR int week_number(const ymd_type&ymd);
static BOOST_CXX14_CONSTEXPR date_int_type day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR date_int_type julian_day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR date_int_type modjulian_day_number(const ymd_type& ymd);
static BOOST_CXX14_CONSTEXPR ymd_type from_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR ymd_type from_julian_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR ymd_type from_modjulian_day_number(date_int_type);
static BOOST_CXX14_CONSTEXPR bool is_leap_year(year_type);
static BOOST_CXX14_CONSTEXPR unsigned short end_of_month_day(year_type y, month_type m);
static BOOST_CXX14_CONSTEXPR ymd_type epoch();
static BOOST_CXX14_CONSTEXPR unsigned short days_in_week();
};
} } //namespace
#ifndef NO_BOOST_DATE_TIME_INLINE
#include "boost/date_time/gregorian_calendar.ipp"
#endif
#endif
+65 -60
View File
@@ -1,23 +1,20 @@
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#ifndef NO_BOOST_DATE_TIME_INLINE
#undef BOOST_DATE_TIME_INLINE
#define BOOST_DATE_TIME_INLINE inline
#endif
namespace boost {
namespace date_time {
//! Return the day of the week (0==Sunday, 1==Monday, etc)
/*! Converts a the year-month-day into a day of the week number
/*! Converts a year-month-day into a day of the week number
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::day_of_week(const ymd_type& ymd) {
unsigned short a = static_cast<unsigned short>((14-ymd.month)/12);
@@ -27,29 +24,30 @@ namespace date_time {
//std::cout << year << "-" << month << "-" << day << " is day: " << d << "\n";
return d;
}
//!Return the iso week number for the date
/*!Implements the rules associated with the iso 8601 week number.
Basically the rule is that Week 1 of the year is the week that contains
//!Return the ISO 8601 week number for the date
/*!Implements the rules associated with the ISO 8601 week number.
Basically the rule is that Week 1 of the year is the week that contains
January 4th or the week that contains the first Thursday in January.
Reference for this algorithm is the Calendar FAQ by Claus Tondering, April 2000.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
int
gregorian_calendar_base<ymd_type_,date_int_type_>::week_number(const ymd_type& ymd) {
unsigned long julianbegin = julian_day_number(ymd_type(ymd.year,1,1));
unsigned long juliantoday = julian_day_number(ymd);
unsigned long day = (julianbegin + 3) % 7;
unsigned long week = (juliantoday + day - julianbegin + 4)/7;
if ((week >= 1) && (week <= 52)) {
return week;
return static_cast<int>(week);
}
if ((week == 53)) {
if (week == 53) {
if((day==6) ||(day == 5 && is_leap_year(ymd.year))) {
return week; //under these circumstances week == 53.
return static_cast<int>(week); //under these circumstances week == 53.
} else {
return 1; //monday - wednesday is in week 1 of next year
}
@@ -60,35 +58,37 @@ namespace date_time {
juliantoday = julian_day_number(ymd);
day = (julianbegin + 3) % 7;
week = (juliantoday + day - julianbegin + 4)/7;
return week;
return static_cast<int>(week);
}
return week; //not reachable -- well except if day == 5 and is_leap_year != true
return static_cast<int>(week); //not reachable -- well except if day == 5 and is_leap_year != true
}
//! Convert a ymd_type into a day number
/*! The day number is an absolute number of days since the start of count
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd)
gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd)
{
unsigned short a = static_cast<unsigned short>((14-ymd.month)/12);
unsigned short y = static_cast<unsigned short>(ymd.year + 4800 - a);
unsigned short m = static_cast<unsigned short>(ymd.month + 12*a - 3);
unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045;
return d;
unsigned long d = static_cast<unsigned long>(ymd.day) + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045;
return static_cast<date_int_type>(d);
}
//! Convert a year-month-day into the julian day number
/*! Since this implementation uses julian day internally, this is the same as the day_number.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::julian_day_number(const ymd_type& ymd)
gregorian_calendar_base<ymd_type_,date_int_type_>::julian_day_number(const ymd_type& ymd)
{
return day_number(ymd);
}
@@ -98,18 +98,20 @@ namespace date_time {
* MJD 0 thus started on 17 Nov 1858(Gregorian) at 00:00:00 UTC
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
long
gregorian_calendar_base<ymd_type_,date_int_type_>::modjulian_day_number(const ymd_type& ymd)
BOOST_CXX14_CONSTEXPR
inline
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::modjulian_day_number(const ymd_type& ymd)
{
return julian_day_number(ymd)-2400001; //prerounded
}
//! Change a day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_day_number(date_int_type dayNumber)
gregorian_calendar_base<ymd_type_,date_int_type_>::from_day_number(date_int_type dayNumber)
{
date_int_type a = dayNumber + 32044;
date_int_type b = (4*a + 3)/146097;
@@ -121,15 +123,16 @@ namespace date_time {
unsigned short month = static_cast<unsigned short>(m + 3 - 12 * (m/10));
year_type year = static_cast<unsigned short>(100*b + d - 4800 + (m/10));
//std::cout << year << "-" << month << "-" << day << "\n";
return ymd_type(static_cast<unsigned short>(year),month,day);
}
//! Change a day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_julian_day_number(date_int_type dayNumber)
gregorian_calendar_base<ymd_type_,date_int_type_>::from_julian_day_number(date_int_type dayNumber)
{
date_int_type a = dayNumber + 32044;
date_int_type b = (4*a+3)/146097;
@@ -141,41 +144,44 @@ namespace date_time {
unsigned short month = static_cast<unsigned short>(m + 3 - 12 * (m/10));
year_type year = static_cast<year_type>(100*b + d - 4800 + (m/10));
//std::cout << year << "-" << month << "-" << day << "\n";
return ymd_type(year,month,day);
}
//! Change a modified julian day number into a year-month-day
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::from_modjulian_day_number(long dayNumber) {
gregorian_calendar_base<ymd_type_,date_int_type_>::from_modjulian_day_number(date_int_type dayNumber) {
date_int_type jd = dayNumber + 2400001; //is 2400000.5 prerounded
return from_julian_day_number(jd);
}
//! Determine if the provided year is a leap year
/*!
*@return true if year is a leap year, false otherwise
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
bool
gregorian_calendar_base<ymd_type_,date_int_type_>::is_leap_year(year_type year)
gregorian_calendar_base<ymd_type_,date_int_type_>::is_leap_year(year_type year)
{
//divisible by 4, not if divisible by 100, but true if divisible by 400
return (!(year % 4)) && ((year % 100) || (!(year % 400)));
}
//! Calculate the last day of the month
/*! Find the day which is the end of the month given year and month
* No error checking is performed.
*/
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::end_of_month_day(year_type year,
month_type month)
month_type month)
{
switch (month) {
case 2:
@@ -183,7 +189,7 @@ namespace date_time {
return 29;
} else {
return 28;
};
}
case 4:
case 6:
case 9:
@@ -191,29 +197,28 @@ namespace date_time {
return 30;
default:
return 31;
};
}
}
//! Provide the ymd_type specification for the calandar start
//! Provide the ymd_type specification for the calendar start
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
ymd_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::epoch()
gregorian_calendar_base<ymd_type_,date_int_type_>::epoch()
{
return ymd_type(1400,1,1);
}
//! Defines length of a week for week calculations
template<typename ymd_type_, typename date_int_type_>
BOOST_DATE_TIME_INLINE
BOOST_CXX14_CONSTEXPR
inline
unsigned short
gregorian_calendar_base<ymd_type_,date_int_type_>::days_in_week()
gregorian_calendar_base<ymd_type_,date_int_type_>::days_in_week()
{
return 7;
}
} } //namespace gregorian
+76 -67
View File
@@ -14,7 +14,15 @@
#include "boost/limits.hpp" //work around compilers without limits
#include "boost/date_time/special_defs.hpp"
#include "boost/date_time/locale_config.hpp"
#include <iostream>
#ifndef BOOST_DATE_TIME_NO_LOCALE
# include <ostream>
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
// conditional expression is constant
#pragma warning(disable: 4127)
#endif
namespace boost {
namespace date_time {
@@ -38,34 +46,34 @@ template<typename int_type_>
class int_adapter {
public:
typedef int_type_ int_type;
int_adapter(int_type v) :
BOOST_CXX14_CONSTEXPR int_adapter(int_type v) :
value_(v)
{}
static bool has_infinity()
static BOOST_CONSTEXPR bool has_infinity()
{
return true;
}
static const int_adapter pos_infinity()
static BOOST_CONSTEXPR int_adapter pos_infinity()
{
return (::std::numeric_limits<int_type>::max)();
}
static const int_adapter neg_infinity()
static BOOST_CONSTEXPR int_adapter neg_infinity()
{
return (::std::numeric_limits<int_type>::min)();
}
static const int_adapter not_a_number()
static BOOST_CONSTEXPR int_adapter not_a_number()
{
return (::std::numeric_limits<int_type>::max)()-1;
}
static int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
static BOOST_CONSTEXPR int_adapter max BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return (::std::numeric_limits<int_type>::max)()-2;
}
static int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
static BOOST_CONSTEXPR int_adapter min BOOST_PREVENT_MACRO_SUBSTITUTION ()
{
return (::std::numeric_limits<int_type>::min)()+1;
}
static int_adapter from_special(special_values sv)
static BOOST_CXX14_CONSTEXPR int_adapter from_special(special_values sv)
{
switch (sv) {
case not_a_date_time: return not_a_number();
@@ -76,25 +84,25 @@ public:
default: return not_a_number();
}
}
static bool is_inf(int_type v)
static BOOST_CONSTEXPR bool is_inf(int_type v)
{
return (v == neg_infinity().as_number() ||
v == pos_infinity().as_number());
}
static bool is_neg_inf(int_type v)
static BOOST_CXX14_CONSTEXPR bool is_neg_inf(int_type v)
{
return (v == neg_infinity().as_number());
}
static bool is_pos_inf(int_type v)
static BOOST_CXX14_CONSTEXPR bool is_pos_inf(int_type v)
{
return (v == pos_infinity().as_number());
}
static bool is_not_a_number(int_type v)
static BOOST_CXX14_CONSTEXPR bool is_not_a_number(int_type v)
{
return (v == not_a_number().as_number());
}
//! Returns either special value type or is_not_special
static special_values to_special(int_type v)
static BOOST_CXX14_CONSTEXPR special_values to_special(int_type v)
{
if (is_not_a_number(v)) return not_a_date_time;
if (is_neg_inf(v)) return neg_infin;
@@ -103,40 +111,38 @@ public:
}
//-3 leaves room for representations of infinity and not a date
static int_type maxcount()
static BOOST_CONSTEXPR int_type maxcount()
{
return (::std::numeric_limits<int_type>::max)()-3;
}
bool is_infinity() const
BOOST_CONSTEXPR bool is_infinity() const
{
return (value_ == neg_infinity().as_number() ||
value_ == pos_infinity().as_number());
}
bool is_pos_infinity()const
BOOST_CONSTEXPR bool is_pos_infinity()const
{
return(value_ == pos_infinity().as_number());
}
bool is_neg_infinity()const
BOOST_CONSTEXPR bool is_neg_infinity()const
{
return(value_ == neg_infinity().as_number());
}
bool is_nan() const
BOOST_CONSTEXPR bool is_nan() const
{
return (value_ == not_a_number().as_number());
}
bool is_special() const
BOOST_CONSTEXPR bool is_special() const
{
return(is_infinity() || is_nan());
}
bool operator==(const int_adapter& rhs) const
BOOST_CONSTEXPR bool operator==(const int_adapter& rhs) const
{
return (compare(rhs) == 0);
}
bool operator==(const int& rhs) const
BOOST_CXX14_CONSTEXPR bool operator==(const int& rhs) const
{
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
if(!std::numeric_limits<int_type>::is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
@@ -145,15 +151,13 @@ public:
}
return (compare(rhs) == 0);
}
bool operator!=(const int_adapter& rhs) const
BOOST_CONSTEXPR bool operator!=(const int_adapter& rhs) const
{
return (compare(rhs) != 0);
}
bool operator!=(const int& rhs) const
BOOST_CXX14_CONSTEXPR bool operator!=(const int& rhs) const
{
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
if(!std::numeric_limits<int_type>::is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
@@ -162,15 +166,14 @@ public:
}
return (compare(rhs) != 0);
}
bool operator<(const int_adapter& rhs) const
BOOST_CONSTEXPR bool operator<(const int_adapter& rhs) const
{
return (compare(rhs) == -1);
}
bool operator<(const int& rhs) const
BOOST_CXX14_CONSTEXPR bool operator<(const int& rhs) const
{
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(!is_signed)
if(!std::numeric_limits<int_type>::is_signed)
{
if(is_neg_inf(value_) && rhs == 0)
{
@@ -179,16 +182,16 @@ public:
}
return (compare(rhs) == -1);
}
bool operator>(const int_adapter& rhs) const
BOOST_CONSTEXPR bool operator>(const int_adapter& rhs) const
{
return (compare(rhs) == 1);
}
int_type as_number() const
BOOST_CONSTEXPR int_type as_number() const
{
return value_;
}
//! Returns either special value type or is_not_special
special_values as_special() const
BOOST_CONSTEXPR special_values as_special() const
{
return int_adapter::to_special(value_);
}
@@ -201,7 +204,7 @@ public:
/*! Operator allows for adding dissimilar int_adapter types.
* The return type will match that of the the calling object's type */
template<class rhs_type>
inline
BOOST_CXX14_CONSTEXPR
int_adapter operator+(const int_adapter<rhs_type>& rhs) const
{
if(is_special() || rhs.is_special())
@@ -228,9 +231,10 @@ public:
return int_adapter::neg_infinity();
}
}
return int_adapter<int_type>(value_ + rhs.as_number());
return int_adapter<int_type>(value_ + static_cast<int_type>(rhs.as_number()));
}
BOOST_CXX14_CONSTEXPR
int_adapter operator+(const int_type rhs) const
{
if(is_special())
@@ -250,7 +254,7 @@ public:
/*! Operator allows for subtracting dissimilar int_adapter types.
* The return type will match that of the the calling object's type */
template<class rhs_type>
inline
BOOST_CXX14_CONSTEXPR
int_adapter operator-(const int_adapter<rhs_type>& rhs)const
{
if(is_special() || rhs.is_special())
@@ -277,8 +281,10 @@ public:
return int_adapter::pos_infinity();
}
}
return int_adapter<int_type>(value_ - rhs.as_number());
return int_adapter<int_type>(value_ - static_cast<int_type>(rhs.as_number()));
}
BOOST_CXX14_CONSTEXPR
int_adapter operator-(const int_type rhs) const
{
if(is_special())
@@ -296,6 +302,7 @@ public:
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator*(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -304,8 +311,10 @@ public:
}
return int_adapter<int_type>(value_ * rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator*(const int rhs) const
{
if(is_special())
@@ -316,6 +325,7 @@ public:
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator/(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -329,23 +339,27 @@ public:
return mult_div_specials(rhs);
}
else { // let divide by zero blow itself up
return int_adapter<int_type>(value_ / rhs.value_);
return int_adapter<int_type>(value_ / rhs.value_); //NOLINT
}
}
return int_adapter<int_type>(value_ / rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator/(const int rhs) const
{
if(is_special() && rhs != 0)
{
return mult_div_specials(rhs);
}
return int_adapter<int_type>(value_ / rhs);
// let divide by zero blow itself up like int
return int_adapter<int_type>(value_ / rhs); //NOLINT
}
// should templatize this to be consistant with op +-
BOOST_CXX14_CONSTEXPR
int_adapter operator%(const int_adapter& rhs)const
{
if(this->is_special() || rhs.is_special())
@@ -359,26 +373,31 @@ public:
return mult_div_specials(rhs);
}
else { // let divide by zero blow itself up
return int_adapter<int_type>(value_ % rhs.value_);
return int_adapter<int_type>(value_ % rhs.value_); //NOLINT
}
}
return int_adapter<int_type>(value_ % rhs.value_);
}
/*! Provided for cases when automatic conversion from
* 'int' to 'int_adapter' causes incorrect results. */
BOOST_CXX14_CONSTEXPR
int_adapter operator%(const int rhs) const
{
if(is_special() && rhs != 0)
{
return mult_div_specials(rhs);
}
return int_adapter<int_type>(value_ % rhs);
// let divide by zero blow itself up
return int_adapter<int_type>(value_ % rhs); //NOLINT
}
private:
int_type value_;
//! returns -1, 0, 1, or 2 if 'this' is <, ==, >, or 'nan comparison' rhs
int compare(const int_adapter& rhs)const
BOOST_CXX14_CONSTEXPR
int compare( const int_adapter& rhs ) const
{
if(this->is_special() || rhs.is_special())
{
@@ -405,25 +424,19 @@ private:
// implied-> if(value_ == rhs.value_)
return 0;
}
/* When multiplying and dividing with at least 1 special value
* very simmilar rules apply. In those cases where the rules
* are different, they are handled in the respective operator
* function. */
//! Assumes at least 'this' or 'rhs' is a special value
int_adapter mult_div_specials(const int_adapter& rhs)const
BOOST_CXX14_CONSTEXPR
int_adapter mult_div_specials(const int_adapter& rhs) const
{
int min_value;
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(is_signed) {
min_value = 0;
}
else {
min_value = 1;// there is no zero with unsigned
}
if(this->is_nan() || rhs.is_nan()) {
return int_adapter<int_type>(not_a_number());
}
BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1;
if((*this > 0 && rhs > 0) || (*this < min_value && rhs < min_value)) {
return int_adapter<int_type>(pos_infinity());
}
@@ -433,26 +446,20 @@ private:
//implied -> if(this->value_ == 0 || rhs.value_ == 0)
return int_adapter<int_type>(not_a_number());
}
/* Overloaded function necessary because of special
* situation where int_adapter is instantiated with
* 'unsigned' and func is called with negative int.
* It would produce incorrect results since 'unsigned'
* wraps around when initialized with a negative value */
//! Assumes 'this' is a special value
BOOST_CXX14_CONSTEXPR
int_adapter mult_div_specials(const int& rhs) const
{
int min_value;
// quiets compiler warnings
bool is_signed = std::numeric_limits<int_type>::is_signed;
if(is_signed) {
min_value = 0;
}
else {
min_value = 1;// there is no zero with unsigned
}
if(this->is_nan()) {
return int_adapter<int_type>(not_a_number());
}
BOOST_CONSTEXPR_OR_CONST int min_value = std::numeric_limits<int_type>::is_signed ? 0 : 1;
if((*this > 0 && rhs > 0) || (*this < min_value && rhs < 0)) {
return int_adapter<int_type>(pos_infinity());
}
@@ -462,7 +469,7 @@ private:
//implied -> if(this->value_ == 0 || rhs.value_ == 0)
return int_adapter<int_type>(not_a_number());
}
};
#ifndef BOOST_DATE_TIME_NO_LOCALE
@@ -502,6 +509,8 @@ private:
} } //namespace date_time
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif
+13 -13
View File
@@ -14,11 +14,11 @@
namespace boost {
namespace date_time {
//! Class to provide common iso formatting spec
//! Class to provide common ISO 8601 formatting spec
template<class charT>
class iso_format_base {
public:
//! Describe month format -- its an integer in iso format
//! Describe month format -- its an integer in ISO 8601 format
static month_format_spec month_format()
{
return month_as_integer;
@@ -40,17 +40,17 @@ public:
return "-infinity";
}
//! ISO char for a year -- used in durations
//! ISO 8601 char for a year -- used in durations
static charT year_sep_char()
{
return 'Y';
}
//! ISO char for a month
//! ISO 8601 char for a month
static charT month_sep_char()
{
return '-';
}
//! ISO char for a day
//! ISO 8601 char for a day
static charT day_sep_char()
{
return '-';
@@ -70,7 +70,7 @@ public:
{
return ':';
}
//! ISO char for a period
//! ISO 8601 char for a period
static charT period_start_char()
{
return 'P';
@@ -143,11 +143,11 @@ public:
#ifndef BOOST_NO_STD_WSTRING
//! Class to provide common iso formatting spec
//! Class to provide common ISO 8601 formatting spec
template<>
class iso_format_base<wchar_t> {
public:
//! Describe month format -- its an integer in iso format
//! Describe month format -- its an integer in ISO 8601 format
static month_format_spec month_format()
{
return month_as_integer;
@@ -169,17 +169,17 @@ public:
return L"-infinity";
}
//! ISO char for a year -- used in durations
//! ISO 8601 char for a year -- used in durations
static wchar_t year_sep_char()
{
return 'Y';
}
//! ISO char for a month
//! ISO 8601 char for a month
static wchar_t month_sep_char()
{
return '-';
}
//! ISO char for a day
//! ISO 8601 char for a day
static wchar_t day_sep_char()
{
return '-';
@@ -199,7 +199,7 @@ public:
{
return ':';
}
//! ISO char for a period
//! ISO 8601 char for a period
static wchar_t period_start_char()
{
return 'P';
@@ -272,7 +272,7 @@ public:
#endif // BOOST_NO_STD_WSTRING
//! Format description for iso normal YYYYMMDD
//! Format description for ISO 8601 normal YYYYMMDD
template<class charT>
class iso_format : public iso_format_base<charT> {
public:
@@ -18,9 +18,8 @@ namespace local_time {
//! Function that creates a tm struct from a local_date_time
inline
tm to_tm(const local_date_time& lt) {
tm lt_tm;
lt_tm = posix_time::to_tm(lt.local_time());
std::tm to_tm(const local_date_time& lt) {
std::tm lt_tm = posix_time::to_tm(lt.local_time());
if(lt.is_dst()){
lt_tm.tm_isdst = 1;
}
@@ -2,7 +2,7 @@
#define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__
/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
@@ -34,8 +34,8 @@ namespace local_time {
typedef typename base_type::stringstream_type stringstream_type;
typedef date_time::time_zone_names_base<CharT> time_zone_names;
typedef CharT char_type;
custom_time_zone_base(const time_zone_names& zone_names,
custom_time_zone_base(const time_zone_names& zone_names,
const time_duration_type& utc_offset,
const dst_adjustment_offsets& dst_shift,
boost::shared_ptr<dst_calc_rule> calc_rule) :
@@ -43,8 +43,8 @@ namespace local_time {
base_utc_offset_(utc_offset),
dst_offsets_(dst_shift),
dst_calc_rules_(calc_rule)
{};
virtual ~custom_time_zone_base() {};
{}
virtual ~custom_time_zone_base() {}
virtual string_type dst_zone_abbrev() const
{
return zone_names_.dst_zone_abbrev();
@@ -64,7 +64,7 @@ namespace local_time {
//! True if zone uses daylight savings adjustments
virtual bool has_dst() const
{
return (dst_calc_rules_); //if calc_rule is set the tz has dst
return (bool) dst_calc_rules_; //if calc_rule is set the tz has dst
}
//! Local time that DST starts -- NADT if has_dst is false
virtual posix_time::ptime dst_local_start_time(gregorian::greg_year y) const
@@ -154,7 +154,6 @@ namespace local_time {
}
private:
time_zone_names zone_names_;
bool has_dst_;
time_duration_type base_utc_offset_;
dst_adjustment_offsets dst_offsets_;
boost::shared_ptr<dst_calc_rule> dst_calc_rules_;
@@ -2,44 +2,48 @@
#define LOCAL_TIME_LOCAL_DATE_TIME_HPP__
/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/time.hpp"
#include "boost/date_time/posix_time/posix_time.hpp" //todo remove?
#include "boost/shared_ptr.hpp"
#include "boost/date_time/dst_rules.hpp"
#include "boost/date_time/time_zone_base.hpp"
#include "boost/date_time/special_defs.hpp"
#include <string>
#include <iomanip>
#include <sstream>
#include <stdexcept>
#include <boost/shared_ptr.hpp>
#include <boost/throw_exception.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp> //todo remove?
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/dst_rules.hpp>
#include <boost/date_time/time_zone_base.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/time_resolution_traits.hpp> // absolute_value
namespace boost {
namespace local_time {
//! simple exception for reporting when STD or DST cannot be determined
struct ambiguous_result : public std::logic_error
struct BOOST_SYMBOL_VISIBLE ambiguous_result : public std::logic_error
{
ambiguous_result (std::string _msg="") :
std::logic_error(std::string("Daylight Savings Results are ambiguous: " + _msg)) {}
ambiguous_result (std::string const& msg = std::string()) :
std::logic_error(std::string("Daylight Savings Results are ambiguous: " + msg)) {}
};
//! simple exception for when time label given cannot exist
struct time_label_invalid : public std::logic_error
struct BOOST_SYMBOL_VISIBLE time_label_invalid : public std::logic_error
{
time_label_invalid (std::string _msg="") :
std::logic_error(std::string("Time label given is invalid: " + _msg)) {}
time_label_invalid (std::string const& msg = std::string()) :
std::logic_error(std::string("Time label given is invalid: " + msg)) {}
};
struct dst_not_valid: public std::logic_error
struct BOOST_SYMBOL_VISIBLE dst_not_valid: public std::logic_error
{
dst_not_valid(std::string _msg="") :
std::logic_error(std::string("is_dst flag does not match resulting dst for time label given: " + _msg)) {}
dst_not_valid(std::string const& msg = std::string()) :
std::logic_error(std::string("is_dst flag does not match resulting dst for time label given: " + msg)) {}
};
//TODO: I think these should be in local_date_time_base and not
//TODO: I think these should be in local_date_time_base and not
// necessarily brought into the namespace
using date_time::time_is_dst_result;
using date_time::is_in_dst;
@@ -49,17 +53,17 @@ namespace local_time {
//! Representation of "wall-clock" time in a particular time zone
/*! Representation of "wall-clock" time in a particular time zone
* Local_date_time_base holds a time value (date and time offset from 00:00)
* along with a time zone. The time value is stored as UTC and conversions
* to wall clock time are made as needed. This approach allows for
* operations between wall-clock times in different time zones, and
* daylight savings time considerations, to be made. Time zones are
* Local_date_time_base holds a time value (date and time offset from 00:00)
* along with a time zone. The time value is stored as UTC and conversions
* to wall clock time are made as needed. This approach allows for
* operations between wall-clock times in different time zones, and
* daylight savings time considerations, to be made. Time zones are
* required to be in the form of a boost::shared_ptr<time_zone_base>.
*/
template<class utc_time_=posix_time::ptime,
template<class utc_time_=posix_time::ptime,
class tz_type=date_time::time_zone_base<utc_time_,char> >
class local_date_time_base : public date_time::base_time<utc_time_,
boost::posix_time::posix_time_system> {
class BOOST_SYMBOL_VISIBLE local_date_time_base : public date_time::base_time<utc_time_,
boost::posix_time::posix_time_system> {
public:
typedef utc_time_ utc_time_type;
typedef typename utc_time_type::time_duration_type time_duration_type;
@@ -68,41 +72,41 @@ namespace local_time {
typedef typename utc_time_type::time_system_type time_system_type;
/*! This constructor interprets the passed time as a UTC time.
* So, for example, if the passed timezone is UTC-5 then the
* time will be adjusted back 5 hours. The time zone allows for
* time will be adjusted back 5 hours. The time zone allows for
* automatic calculation of whether the particular time is adjusted for
* daylight savings, etc.
* If the time zone shared pointer is null then time stays unadjusted.
*@param t A UTC time
*@param tz Timezone for to adjust the UTC time to.
*/
local_date_time_base(utc_time_type t,
boost::shared_ptr<tz_type> tz) :
local_date_time_base(utc_time_type t,
boost::shared_ptr<tz_type> tz) :
date_time::base_time<utc_time_type, time_system_type>(t),
zone_(tz)
{
// param was already utc so nothing more to do
}
}
/*! This constructs a local time -- the passed time information
* understood to be in the passed tz. The DST flag must be passed
* to indicate whether the time is in daylight savings or not.
* @throws -- time_label_invalid if the time passed does not exist in
* the given locale. The non-existent case occurs typically
* during the shift-back from daylight savings time. When
* the clock is shifted forward a range of times
/*! This constructs a local time -- the passed time information
* understood to be in the passed tz. The DST flag must be passed
* to indicate whether the time is in daylight savings or not.
* @throws -- time_label_invalid if the time passed does not exist in
* the given locale. The non-existent case occurs typically
* during the shift-back from daylight savings time. When
* the clock is shifted forward a range of times
* (2 am to 3 am in the US) is skipped and hence is invalid.
* @throws -- dst_not_valid if the DST flag is passed for a period
* @throws -- dst_not_valid if the DST flag is passed for a period
* where DST is not active.
*/
local_date_time_base(date_type d,
local_date_time_base(date_type d,
time_duration_type td,
boost::shared_ptr<tz_type> tz,
boost::shared_ptr<tz_type> tz,
bool dst_flag) : //necessary for constr_adj()
date_time::base_time<utc_time_type,time_system_type>(construction_adjustment(utc_time_type(d, td), tz, dst_flag)),
zone_(tz)
{
if(tz != boost::shared_ptr<tz_type>() && tz->has_dst()){
// d & td are already local so we use them
time_is_dst_result result = check_dst(d, td, tz);
bool in_dst = (result == is_in_dst); // less processing than is_dst()
@@ -110,35 +114,35 @@ namespace local_time {
// ambig occurs at end, invalid at start
if(result == invalid_time_label){
// Ex: 2:15am local on trans-in day in nyc, dst_flag irrelevant
std::stringstream ss;
std::ostringstream ss;
ss << "time given: " << d << ' ' << td;
throw time_label_invalid(ss.str());
boost::throw_exception(time_label_invalid(ss.str()));
}
else if(result != ambiguous && in_dst != dst_flag){
// is dst_flag accurate?
// Ex: false flag in NYC in June
std::stringstream ss;
ss << "flag given: " << (dst_flag ? "dst=true" : "dst=false")
<< ", dst calculated: " << (in_dst ? "dst=true" : "dst=false");
throw dst_not_valid(ss.str());
std::ostringstream ss;
ss.setf(std::ios_base::boolalpha);
ss << "flag given: dst=" << dst_flag << ", dst calculated: dst=" << in_dst;
boost::throw_exception(dst_not_valid(ss.str()));
}
// everything checks out and conversion to utc already done
}
}
}
//TODO maybe not the right set...Ignore the last 2 for now...
enum DST_CALC_OPTIONS { EXCEPTION_ON_ERROR, NOT_DATE_TIME_ON_ERROR };
enum DST_CALC_OPTIONS { EXCEPTION_ON_ERROR, NOT_DATE_TIME_ON_ERROR };
//ASSUME_DST_ON_ERROR, ASSUME_NOT_DST_ON_ERROR };
/*! This constructs a local time -- the passed time information
* understood to be in the passed tz. The DST flag is calculated
* according to the specified rule.
/*! This constructs a local time -- the passed time information
* understood to be in the passed tz. The DST flag is calculated
* according to the specified rule.
*/
local_date_time_base(date_type d,
local_date_time_base(date_type d,
time_duration_type td,
boost::shared_ptr<tz_type> tz,
DST_CALC_OPTIONS calc_option) :
boost::shared_ptr<tz_type> tz,
DST_CALC_OPTIONS calc_option) :
// dummy value - time_ is set in constructor code
date_time::base_time<utc_time_type,time_system_type>(utc_time_type(d,td)),
zone_(tz)
@@ -146,9 +150,9 @@ namespace local_time {
time_is_dst_result result = check_dst(d, td, tz);
if(result == ambiguous) {
if(calc_option == EXCEPTION_ON_ERROR){
std::stringstream ss;
std::ostringstream ss;
ss << "time given: " << d << ' ' << td;
throw ambiguous_result(ss.str());
boost::throw_exception(ambiguous_result(ss.str()));
}
else{ // NADT on error
this->time_ = posix_time::posix_time_system::get_time_rep(date_type(date_time::not_a_date_time), time_duration_type(date_time::not_a_date_time));
@@ -156,45 +160,45 @@ namespace local_time {
}
else if(result == invalid_time_label){
if(calc_option == EXCEPTION_ON_ERROR){
std::stringstream ss;
std::ostringstream ss;
ss << "time given: " << d << ' ' << td;
throw time_label_invalid(ss.str());
boost::throw_exception(time_label_invalid(ss.str()));
}
else{ // NADT on error
this->time_ = posix_time::posix_time_system::get_time_rep(date_type(date_time::not_a_date_time), time_duration_type(date_time::not_a_date_time));
}
}
else if(result == is_in_dst){
utc_time_type t =
utc_time_type t =
construction_adjustment(utc_time_type(d, td), tz, true);
this->time_ = posix_time::posix_time_system::get_time_rep(t.date(),
this->time_ = posix_time::posix_time_system::get_time_rep(t.date(),
t.time_of_day());
}
else{
utc_time_type t =
utc_time_type t =
construction_adjustment(utc_time_type(d, td), tz, false);
this->time_ = posix_time::posix_time_system::get_time_rep(t.date(),
this->time_ = posix_time::posix_time_system::get_time_rep(t.date(),
t.time_of_day());
}
}
//! Determines if given time label is in daylight savings for given zone
/*! Determines if given time label is in daylight savings for given zone.
* Takes a date and time_duration representing a local time, along
/*! Determines if given time label is in daylight savings for given zone.
* Takes a date and time_duration representing a local time, along
* with time zone, and returns a time_is_dst_result object as result.
*/
static time_is_dst_result check_dst(date_type d,
static time_is_dst_result check_dst(date_type d,
time_duration_type td,
boost::shared_ptr<tz_type> tz)
boost::shared_ptr<tz_type> tz)
{
if(tz != boost::shared_ptr<tz_type>() && tz->has_dst()) {
typedef typename date_time::dst_calculator<date_type, time_duration_type> dst_calculator;
return dst_calculator::local_is_dst(
d, td,
tz->dst_local_start_time(d.year()).date(),
tz->dst_local_start_time(d.year()).time_of_day(),
tz->dst_local_end_time(d.year()).date(),
d, td,
tz->dst_local_start_time(d.year()).date(),
tz->dst_local_start_time(d.year()).time_of_day(),
tz->dst_local_end_time(d.year()).date(),
tz->dst_local_end_time(d.year()).time_of_day(),
tz->dst_offset()
);
@@ -205,10 +209,10 @@ namespace local_time {
}
//! Simple destructor, releases time zone if last referrer
~local_date_time_base() {};
~local_date_time_base() {}
//! Copy constructor
local_date_time_base(const local_date_time_base& rhs) :
local_date_time_base(const local_date_time_base& rhs) :
date_time::base_time<utc_time_type, time_system_type>(rhs),
zone_(rhs.zone_)
{}
@@ -221,7 +225,7 @@ namespace local_time {
{}
//! returns time zone associated with calling instance
boost::shared_ptr<tz_type> zone() const
boost::shared_ptr<tz_type> zone() const
{
return zone_;
}
@@ -240,12 +244,12 @@ namespace local_time {
return false;
case is_in_dst:
return true;
case ambiguous:
case ambiguous:
if(lt + zone_->dst_offset() < zone_->dst_local_end_time(lt.date().year())) {
return true;
}
break;
case invalid_time_label:
case invalid_time_label:
if(lt >= zone_->dst_local_start_time(lt.date().year())) {
return true;
}
@@ -255,12 +259,12 @@ namespace local_time {
return false;
}
//! Returns object's time value as a utc representation
utc_time_type utc_time() const
utc_time_type utc_time() const
{
return utc_time_type(this->time_);
}
//! Returns object's time value as a local representation
utc_time_type local_time() const
utc_time_type local_time() const
{
if(zone_ != boost::shared_ptr<tz_type>()){
utc_time_type lt = this->utc_time() + zone_->base_utc_offset();
@@ -273,12 +277,12 @@ namespace local_time {
}
//! Returns string in the form "2003-Aug-20 05:00:00 EDT"
/*! Returns string in the form "2003-Aug-20 05:00:00 EDT". If
* time_zone is NULL the time zone abbreviation will be "UTC". The time
* time_zone is NULL the time zone abbreviation will be "UTC". The time
* zone abbrev will not be included if calling object is a special_value*/
std::string to_string() const
{
//TODO is this a temporary function ???
std::stringstream ss;
std::ostringstream ss;
if(this->is_special()){
ss << utc_time();
return ss.str();
@@ -301,17 +305,17 @@ namespace local_time {
}
return ss.str();
}
/*! returns a local_date_time_base in the given time zone with the
/*! returns a local_date_time_base in the given time zone with the
* optional time_duration added. */
local_date_time_base local_time_in(boost::shared_ptr<tz_type> new_tz,
time_duration_type td=time_duration_type(0,0,0)) const
local_date_time_base local_time_in(boost::shared_ptr<tz_type> new_tz,
time_duration_type td=time_duration_type(0,0,0)) const
{
return local_date_time_base(utc_time_type(this->time_) + td, new_tz);
}
//! Returns name of associated time zone or "Coordinated Universal Time".
/*! Optional bool parameter will return time zone as an offset
* (ie "+07:00" extended iso format). Empty string is returned for
//! Returns name of associated time zone or "UTC".
/*! Optional bool parameter will return time zone as an offset
* (ie "+07:00" extended ISO 8601 format). Empty string is returned for
* classes that do not use a time_zone */
std::string zone_name(bool as_offset=false) const
{
@@ -320,7 +324,7 @@ namespace local_time {
return std::string("Z");
}
else {
return std::string("Coordinated Universal Time");
return std::string("UTC");
}
}
if (is_dst()) {
@@ -344,8 +348,8 @@ namespace local_time {
}
}
//! Returns abbreviation of associated time zone or "UTC".
/*! Optional bool parameter will return time zone as an offset
* (ie "+0700" iso format). Empty string is returned for classes
/*! Optional bool parameter will return time zone as an offset
* (ie "+0700" ISO 8601 format). Empty string is returned for classes
* that do not use a time_zone */
std::string zone_abbrev(bool as_offset=false) const
{
@@ -386,7 +390,7 @@ namespace local_time {
}
return zone_->to_posix_string();
}
//! Equality comparison operator
/*bool operator==(const date_time::base_time<boost::posix_time::ptime,boost::posix_time::posix_time_system>& rhs) const
{ // fails due to rhs.time_ being protected
@@ -424,45 +428,45 @@ namespace local_time {
return (*this > rhs || *this == rhs);
}
//! Local_date_time + date_duration
//! Local_date_time + date_duration
local_date_time_base operator+(const date_duration_type& dd) const
{
return local_date_time_base(time_system_type::add_days(this->time_,dd), zone_);
}
//! Local_date_time += date_duration
//! Local_date_time += date_duration
local_date_time_base operator+=(const date_duration_type& dd)
{
this->time_ = time_system_type::add_days(this->time_,dd);
return *this;
}
//! Local_date_time - date_duration
//! Local_date_time - date_duration
local_date_time_base operator-(const date_duration_type& dd) const
{
return local_date_time_base(time_system_type::subtract_days(this->time_,dd), zone_);
}
//! Local_date_time -= date_duration
//! Local_date_time -= date_duration
local_date_time_base operator-=(const date_duration_type& dd)
{
this->time_ = time_system_type::subtract_days(this->time_,dd);
return *this;
}
//! Local_date_time + time_duration
//! Local_date_time + time_duration
local_date_time_base operator+(const time_duration_type& td) const
{
return local_date_time_base(time_system_type::add_time_duration(this->time_,td), zone_);
}
//! Local_date_time += time_duration
local_date_time_base operator+=(const time_duration_type& td)
//! Local_date_time += time_duration
local_date_time_base operator+=(const time_duration_type& td)
{
this->time_ = time_system_type::add_time_duration(this->time_,td);
return *this;
}
//! Local_date_time - time_duration
//! Local_date_time - time_duration
local_date_time_base operator-(const time_duration_type& td) const
{
return local_date_time_base(time_system_type::subtract_time_duration(this->time_,td), zone_);
}
//! Local_date_time -= time_duration
//! Local_date_time -= time_duration
local_date_time_base operator-=(const time_duration_type& td)
{
this->time_ = time_system_type::subtract_time_duration(this->time_,td);
@@ -479,7 +483,7 @@ namespace local_time {
/*! Adjust the passed in time to UTC?
*/
utc_time_type construction_adjustment(utc_time_type t,
utc_time_type construction_adjustment(utc_time_type t,
boost::shared_ptr<tz_type> z,
bool dst_flag)
{
@@ -494,21 +498,21 @@ namespace local_time {
/*! Simple formatting code -- todo remove this?
*/
std::string zone_as_offset(const time_duration_type& td,
std::string zone_as_offset(const time_duration_type& td,
const std::string& separator) const
{
std::stringstream ss;
std::ostringstream ss;
if(td.is_negative()) {
// a negative duration is represented as "-[h]h:mm"
// we require two digits for the hour. A positive duration
// we require two digits for the hour. A positive duration
// with the %H flag will always give two digits
ss << "-";
}
else {
ss << "+";
}
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.hours())
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.hours())
<< separator
<< std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.minutes());
@@ -8,12 +8,18 @@
* $Date$
*/
#include <string>
#include <locale>
#include <iostream>
#include "boost/date_time/local_time/local_date_time.hpp"
#include "boost/date_time/local_time/posix_time_zone.hpp"
#include "boost/date_time/time_facet.hpp"
#include "boost/date_time/string_convert.hpp"
#include "boost/io/ios_state.hpp"
#include <iterator> // i/ostreambuf_iterator
#include <boost/io/ios_state.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/time_facet.hpp>
#include <boost/date_time/string_convert.hpp>
#include <boost/date_time/local_time/local_time_types.hpp>
#include <boost/date_time/local_time/local_date_time.hpp>
#include <boost/date_time/local_time/posix_time_zone.hpp>
#include <boost/date_time/local_time/conversion.hpp> // to_tm will be needed in the facets
namespace boost {
namespace local_time {
@@ -23,7 +29,7 @@ namespace local_time {
typedef boost::date_time::time_input_facet<local_date_time::utc_time_type,wchar_t> wlocal_time_input_facet;
typedef boost::date_time::time_input_facet<local_date_time::utc_time_type,char> local_time_input_facet;
//! operator<< for local_date_time - see local_time docs for formatting details
template<class CharT, class TraitsT>
inline
@@ -33,9 +39,8 @@ namespace local_time {
boost::io::ios_flags_saver iflags(os);
typedef local_date_time time_type;//::utc_time_type typename
typedef date_time::time_facet<time_type, CharT> custom_time_facet;
typedef std::time_put<CharT> std_time_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if(std::has_facet<custom_time_facet>(os.getloc())) {
std::use_facet<custom_time_facet>(os.getloc()).put(oitr,
os,
@@ -60,7 +65,7 @@ namespace local_time {
operator>>(std::basic_istream<CharT, Traits>& is, local_date_time& ldt)
{
boost::io::ios_flags_saver iflags(is);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename local_date_time::utc_time_type utc_time_type;
@@ -69,7 +74,7 @@ namespace local_time {
// intermediate objects
std::basic_string<CharT> tz_str;
utc_time_type pt(not_a_date_time);
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get_local_time(sit, str_end, is, pt, tz_str);
@@ -92,27 +97,91 @@ namespace local_time {
ldt = local_date_time(pt.date(), pt.time_of_day(), tz_ptr, local_date_time::EXCEPTION_ON_ERROR);
}
}
catch(...) {
catch(...) {
// mask tells us what exceptions are turned on
std::ios_base::iostate exception_mask = is.exceptions();
// if the user wants exceptions on failbit, we'll rethrow our
// date_time exception & set the failbit
if(std::ios_base::failbit & exception_mask) {
try { is.setstate(std::ios_base::failbit); }
try { is.setstate(std::ios_base::failbit); }
catch(std::ios_base::failure&) {} // ignore this one
throw; // rethrow original exception
}
else {
// if the user want's to fail quietly, we simply set the failbit
is.setstate(std::ios_base::failbit);
}
is.setstate(std::ios_base::failbit);
}
}
}
return is;
}
//! output operator for local_time_period
template <class CharT, class TraitsT>
inline
std::basic_ostream<CharT, TraitsT>&
operator<<(std::basic_ostream<CharT, TraitsT>& os,
const boost::local_time::local_time_period& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<local_date_time, CharT> custom_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_facet>(os.getloc())) {
std::use_facet<custom_facet>(os.getloc()).put(oitr, os, os.fill(), p);
}
else {
//instantiate a custom facet for dealing with periods since the user
//has not put one in the stream so far. This is for efficiency
//since we would always need to reconstruct for every time period
//if the local did not already exist. Of course this will be overridden
//if the user imbues as some later point.
custom_facet* f = new custom_facet();
std::locale l = std::locale(os.getloc(), f);
os.imbue(l);
f->put(oitr, os, os.fill(), p);
}
return os;
}
//! input operator for local_time_period
template <class CharT, class Traits>
inline
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, boost::local_time::local_time_period& tp)
{
boost::io::ios_flags_saver iflags(is);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<local_date_time, CharT> time_input_facet;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, tp);
}
else {
time_input_facet* f = new time_input_facet();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, tp);
}
}
catch(...) {
std::ios_base::iostate exception_mask = is.exceptions();
if(std::ios_base::failbit & exception_mask) {
try { is.setstate(std::ios_base::failbit); }
catch(std::ios_base::failure&) {}
throw; // rethrow original exception
}
else {
is.setstate(std::ios_base::failbit);
}
}
}
return is;
}
} } // namespaces
#endif // BOOST_DATE_TIME_LOCAL_TIME_IO_HPP__
@@ -1,5 +1,5 @@
#ifndef _DATE_TIME_POSIX_TIME_ZONE__
#define _DATE_TIME_POSIX_TIME_ZONE__
#define _DATE_TIME_POSIX_TIME_ZONE__
/* Copyright (c) 2003-2005 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0. (See accompanying
@@ -10,36 +10,40 @@
#include <string>
#include <sstream>
#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/time_zone_names.hpp"
#include "boost/date_time/time_zone_base.hpp"
#include "boost/date_time/local_time/dst_transition_day_rules.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/date_time/string_convert.hpp"
#include "boost/date_time/time_parsing.hpp"
#include "boost/tokenizer.hpp"
#include <stdexcept>
#include <boost/tokenizer.hpp>
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/time_zone_names.hpp>
#include <boost/date_time/time_zone_base.hpp>
#include <boost/date_time/local_time/dst_transition_day_rules.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/string_convert.hpp>
#include <boost/date_time/time_parsing.hpp>
namespace boost{
namespace local_time{
//! simple exception for UTC and Daylight savings start/end offsets
struct bad_offset : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_offset : public std::out_of_range
{
bad_offset(std::string _msg="") : std::out_of_range(std::string("Offset out of range: " + _msg)) {}
bad_offset(std::string const& msg = std::string()) :
std::out_of_range(std::string("Offset out of range: " + msg)) {}
};
//! simple exception for UTC daylight savings adjustment
struct bad_adjustment : public std::out_of_range
struct BOOST_SYMBOL_VISIBLE bad_adjustment : public std::out_of_range
{
bad_adjustment(std::string _msg="") : std::out_of_range(std::string("Adjustment out of range: " + _msg)) {}
bad_adjustment(std::string const& msg = std::string()) :
std::out_of_range(std::string("Adjustment out of range: " + msg)) {}
};
typedef boost::date_time::dst_adjustment_offsets<boost::posix_time::time_duration> dst_adjustment_offsets;
//! A time zone class constructed from a POSIX time zone string
/*! A POSIX time zone string takes the form of:<br>
* "std offset dst [offset],start[/time],end[/time]" (w/no spaces)
* 'std' specifies the abbrev of the time zone.<br>
* 'std' specifies the abbrev of the time zone.<br>
* 'offset' is the offset from UTC.<br>
* 'dst' specifies the abbrev of the time zone during daylight savings time.<br>
* The second offset is how many hours changed during DST. Default=1<br>
@@ -56,12 +60,15 @@ namespace local_time{
* An invalid date spec (see date class)<br>
* A boost::local_time::bad_offset exception will be thrown for:<br>
* A DST start or end offset that is negative or more than 24 hours<br>
* A UTC zone that is greater than +12 or less than -12 hours<br>
* A UTC zone that is greater than +14 or less than -12 hours<br>
* A boost::local_time::bad_adjustment exception will be thrown for:<br>
* A DST adjustment that is 24 hours or more (positive or negative)<br>
*
* Note that UTC zone offsets can be greater than +12:
* http://www.worldtimezone.com/utc/utc+1200.html
*/
template<class CharT>
class posix_time_zone_base : public date_time::time_zone_base<posix_time::ptime,CharT> {
class BOOST_SYMBOL_VISIBLE posix_time_zone_base : public date_time::time_zone_base<posix_time::ptime,CharT> {
public:
typedef boost::posix_time::time_duration time_duration_type;
typedef date_time::time_zone_names_base<CharT> time_zone_names;
@@ -73,30 +80,43 @@ namespace local_time{
typedef boost::tokenizer<char_separator_type,
typename string_type::const_iterator,
string_type> tokenizer_type;
typedef typename boost::tokenizer<char_separator_type,
typename string_type::const_iterator,
string_type>::iterator tokenizer_iterator_type;
typedef typename tokenizer_type::iterator tokenizer_iterator_type;
//! Construct from a POSIX time zone string
posix_time_zone_base(const string_type& s) :
posix_time_zone_base(const string_type& s) :
//zone_names_("std_name","std_abbrev","no-dst","no-dst"),
zone_names_(),
has_dst_(false),
has_dst_(false),
base_utc_offset_(posix_time::hours(0)),
dst_offsets_(posix_time::hours(0),posix_time::hours(0),posix_time::hours(0)),
dst_calc_rules_()
{
#ifdef __HP_aCC
// Work around bug in aC++ compiler: see QXCR1000880488 in the
// HP bug tracking system
const char_type sep_chars[2] = {',',0};
#else
const char_type sep_chars[2] = {','};
#endif
char_separator_type sep(sep_chars);
tokenizer_type tokens(s, sep);
tokenizer_iterator_type it = tokens.begin();
tokenizer_iterator_type it = tokens.begin(), end = tokens.end();
if (it == end)
BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse time zone name"));
calc_zone(*it++);
if(has_dst_){
string_type tmp_str = *it++;
calc_rules(tmp_str, *it);
if(has_dst_)
{
if (it == end)
BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST begin time"));
string_type dst_begin = *it++;
if (it == end)
BOOST_THROW_EXCEPTION(std::invalid_argument("Could not parse DST end time"));
string_type dst_end = *it;
calc_rules(dst_begin, dst_end);
}
}
virtual ~posix_time_zone_base() {};
}
virtual ~posix_time_zone_base() {}
//!String for the zone when not in daylight savings (eg: EST)
virtual string_type std_zone_abbrev()const
{
@@ -109,15 +129,15 @@ namespace local_time{
return zone_names_.dst_zone_abbrev();
}
//!String for the zone when not in daylight savings (eg: Eastern Standard Time)
/*! The full STD name is not extracted from the posix time zone string.
/*! The full STD name is not extracted from the posix time zone string.
* Therefore, the STD abbreviation is used in it's place */
virtual string_type std_zone_name()const
{
return zone_names_.std_zone_name();
}
//!String for the timezone when in daylight savings (eg: Eastern Daylight Time)
/*! The full DST name is not extracted from the posix time zone string.
* Therefore, the STD abbreviation is used in it's place. For time zones
/*! The full DST name is not extracted from the posix time zone string.
* Therefore, the STD abbreviation is used in it's place. For time zones
* that have no DST, an empty string is used */
virtual string_type dst_zone_name()const
{
@@ -231,51 +251,51 @@ namespace local_time{
void calc_zone(const string_type& obj){
const char_type empty_string[2] = {'\0'};
stringstream_type ss(empty_string);
typename string_type::const_iterator sit = obj.begin();
typename string_type::const_pointer sit = obj.c_str(), obj_end = sit + obj.size();
string_type l_std_zone_abbrev, l_dst_zone_abbrev;
// get 'std' name/abbrev
while(std::isalpha(*sit)){
ss << *sit++;
}
l_std_zone_abbrev = ss.str();
l_std_zone_abbrev = ss.str();
ss.str(empty_string);
// get UTC offset
if(sit != obj.end()){
if(sit != obj_end){
// get duration
while(sit != obj.end() && !std::isalpha(*sit)){
ss << *sit++;
while(sit != obj_end && !std::isalpha(*sit)){
ss << *sit++;
}
base_utc_offset_ = date_time::str_from_delimited_time_duration<time_duration_type,char_type>(ss.str());
base_utc_offset_ = date_time::str_from_delimited_time_duration<time_duration_type,char_type>(ss.str());
ss.str(empty_string);
// base offset must be within range of -12 hours to +12 hours
// base offset must be within range of -12 hours to +14 hours
if(base_utc_offset_ < time_duration_type(-12,0,0) ||
base_utc_offset_ > time_duration_type(12,0,0))
base_utc_offset_ > time_duration_type(14,0,0))
{
throw bad_offset(posix_time::to_simple_string(base_utc_offset_));
boost::throw_exception(bad_offset(posix_time::to_simple_string(base_utc_offset_)));
}
}
// get DST data if given
if(sit != obj.end()){
if(sit != obj_end){
has_dst_ = true;
// get 'dst' name/abbrev
while(sit != obj.end() && std::isalpha(*sit)){
while(sit != obj_end && std::isalpha(*sit)){
ss << *sit++;
}
l_dst_zone_abbrev = ss.str();
l_dst_zone_abbrev = ss.str();
ss.str(empty_string);
// get DST offset if given
if(sit != obj.end()){
if(sit != obj_end){
// get duration
while(sit != obj.end() && !std::isalpha(*sit)){
while(sit != obj_end && !std::isalpha(*sit)){
ss << *sit++;
}
dst_offsets_.dst_adjust_ = date_time::str_from_delimited_time_duration<time_duration_type,char_type>(ss.str());
dst_offsets_.dst_adjust_ = date_time::str_from_delimited_time_duration<time_duration_type,char_type>(ss.str());
ss.str(empty_string);
}
else{ // default DST offset
@@ -286,7 +306,7 @@ namespace local_time{
if(dst_offsets_.dst_adjust_ <= time_duration_type(-24,0,0) ||
dst_offsets_.dst_adjust_ >= time_duration_type(24,0,0))
{
throw bad_adjustment(posix_time::to_simple_string(dst_offsets_.dst_adjust_));
boost::throw_exception(bad_adjustment(posix_time::to_simple_string(dst_offsets_.dst_adjust_)));
}
}
// full names not extracted so abbrevs used in their place
@@ -294,7 +314,13 @@ namespace local_time{
}
void calc_rules(const string_type& start, const string_type& end){
#ifdef __HP_aCC
// Work around bug in aC++ compiler: see QXCR1000880488 in the
// HP bug tracking system
const char_type sep_chars[2] = {'/',0};
#else
const char_type sep_chars[2] = {'/'};
#endif
char_separator_type sep(sep_chars);
tokenizer_type st_tok(start, sep);
tokenizer_type et_tok(end, sep);
@@ -328,7 +354,7 @@ namespace local_time{
if(dst_offsets_.dst_start_offset_ < time_duration_type(0,0,0) ||
dst_offsets_.dst_start_offset_ >= time_duration_type(24,0,0))
{
throw bad_offset(posix_time::to_simple_string(dst_offsets_.dst_start_offset_));
boost::throw_exception(bad_offset(posix_time::to_simple_string(dst_offsets_.dst_start_offset_)));
}
// ending offset
@@ -343,7 +369,7 @@ namespace local_time{
if(dst_offsets_.dst_end_offset_ < time_duration_type(0,0,0) ||
dst_offsets_.dst_end_offset_ >= time_duration_type(24,0,0))
{
throw bad_offset(posix_time::to_simple_string(dst_offsets_.dst_end_offset_));
boost::throw_exception(bad_offset(posix_time::to_simple_string(dst_offsets_.dst_end_offset_)));
}
}
@@ -354,15 +380,21 @@ namespace local_time{
void M_func(const string_type& s, const string_type& e){
typedef gregorian::nth_kday_of_month nkday;
unsigned short sm=0,sw=0,sd=0,em=0,ew=0,ed=0; // start/end month,week,day
#ifdef __HP_aCC
// Work around bug in aC++ compiler: see QXCR1000880488 in the
// HP bug tracking system
const char_type sep_chars[3] = {'M','.',0};
#else
const char_type sep_chars[3] = {'M','.'};
#endif
char_separator_type sep(sep_chars);
tokenizer_type stok(s, sep), etok(e, sep);
tokenizer_iterator_type it = stok.begin();
sm = lexical_cast<unsigned short>(*it++);
sw = lexical_cast<unsigned short>(*it++);
sd = lexical_cast<unsigned short>(*it);
it = etok.begin();
em = lexical_cast<unsigned short>(*it++);
ew = lexical_cast<unsigned short>(*it++);
@@ -371,13 +403,13 @@ namespace local_time{
dst_calc_rules_ = shared_ptr<dst_calc_rule>(
new nth_kday_dst_rule(
nth_last_dst_rule::start_rule(
static_cast<nkday::week_num>(sw),sd,sm),
static_cast<nkday::week_num>(sw),sd,sm),
nth_last_dst_rule::start_rule(
static_cast<nkday::week_num>(ew),ed,em)
static_cast<nkday::week_num>(ew),ed,em)
)
);
}
//! Julian day. Feb29 is never counted, even in leap years
// expects range of 1-365
void julian_no_leap(const string_type& s, const string_type& e){
@@ -399,9 +431,9 @@ namespace local_time{
dst_calc_rules_ = shared_ptr<dst_calc_rule>(
new partial_date_dst_rule(
partial_date_dst_rule::start_rule(
sd, static_cast<date_time::months_of_year>(sm)),
static_cast<unsigned short>(sd), static_cast<date_time::months_of_year>(sm)),
partial_date_dst_rule::end_rule(
ed, static_cast<date_time::months_of_year>(em))
static_cast<unsigned short>(ed), static_cast<date_time::months_of_year>(em))
)
);
}
@@ -436,8 +468,8 @@ namespace local_time{
};
typedef posix_time_zone_base<char> posix_time_zone;
} } // namespace boost::local_time
#endif // _DATE_TIME_POSIX_TIME_ZONE__
#endif // _DATE_TIME_POSIX_TIME_ZONE__
+16 -11
View File
@@ -13,9 +13,13 @@
Time adjustment calculations for local times
*/
#include "boost/date_time/date_generators.hpp"
#include "boost/date_time/dst_rules.hpp"
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/date_generators.hpp>
#include <boost/date_time/dst_rules.hpp>
#include <boost/date_time/time_defs.hpp> // boost::date_time::dst_flags
#include <boost/date_time/special_defs.hpp> // not_a_date_time
namespace boost {
namespace date_time {
@@ -109,7 +113,7 @@ namespace boost {
time_is_dst_result dst_flag =
dst_rules::local_is_dst(initial.date(), initial.time_of_day());
switch(dst_flag) {
case is_in_dst: return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
case is_in_dst: return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
case is_not_in_dst: return utc_offset_rules::utc_to_local_base_offset();
case invalid_time_label:return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
case ambiguous: {
@@ -125,15 +129,15 @@ namespace boost {
}
}
}//case
//TODO better excpetion type
throw std::out_of_range("Unreachable case");
//TODO better exception type
boost::throw_exception(std::out_of_range("Unreachable case"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach
}
//! Get the offset to UTC given a local time
static time_duration_type local_to_utc_offset(const time_type& t,
date_time::dst_flags dst=date_time::calculate)
{
{
switch (dst) {
case is_dst:
return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset();
@@ -146,13 +150,14 @@ namespace boost {
case is_in_dst: return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset();
case is_not_in_dst: return utc_offset_rules::local_to_utc_base_offset();
case ambiguous: return utc_offset_rules::local_to_utc_base_offset();
case invalid_time_label: throw std::out_of_range("Time label invalid");
case invalid_time_label: break;
}
}
throw std::out_of_range("Time label invalid");
}
boost::throw_exception(std::out_of_range("Time label invalid"));
BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach
}
private:
};
@@ -66,7 +66,7 @@ namespace boost {
if (y < 2007) return Apr;
return Mar;
}
static day_of_week_type end_day(year_type y) {return Sunday;}
static day_of_week_type end_day(year_type) {return Sunday;}
static month_type end_month(year_type y)
{
if (y < 2007) return Oct;
+5 -3
View File
@@ -1,7 +1,7 @@
#ifndef DATE_TIME_LOCALE_CONFIG_HPP___
#define DATE_TIME_LOCALE_CONFIG_HPP___
/* Copyright (c) 2002-2006 CrystalClear Software, Inc.
/* Copyright (c) 2002-2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -17,12 +17,14 @@
// defines BOOST_NO_STD_LOCALE (gcc 2.95.x)
#include "boost/config.hpp" //sets BOOST_NO_STD_LOCALE
#include "boost/detail/workaround.hpp"
#include "boost/config/workaround.hpp"
//This file basically becomes a noop if locales are not properly supported
#if (defined(BOOST_NO_STD_LOCALE) \
|| (BOOST_WORKAROUND( BOOST_MSVC, < 1300)) \
|| (BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x581 )) ) )
|| (BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x581 )) ) \
|| (BOOST_WORKAROUND( BOOST_XLCPP_ZOS, BOOST_TESTED_AT( 0x42010000 )) ) /* <cctype> "shadows" the locale enabled overloads from <locale> */ \
)
#define BOOST_DATE_TIME_NO_LOCALE
#endif
+75 -122
View File
@@ -14,14 +14,14 @@
This file contains a high resolution time clock implementation.
*/
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/detail/workaround.hpp>
#include "boost/date_time/c_time.hpp"
#include "boost/date_time/time_clock.hpp"
#include "boost/cstdint.hpp"
#include "boost/shared_ptr.hpp"
#ifdef BOOST_HAS_FTIME
#include <windows.h>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/date_time/time_clock.hpp>
#if defined(BOOST_HAS_FTIME)
#include <boost/winapi/time.hpp>
#endif
#ifdef BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK
@@ -29,7 +29,6 @@
namespace boost {
namespace date_time {
//! A clock providing microsecond level resolution
/*! A high precision clock that measures the local time
* at a resolution up to microseconds and adjusts to the
@@ -41,6 +40,10 @@ namespace date_time {
template<class time_type>
class microsec_clock
{
private:
//! Type for the function used to convert time_t to tm
typedef std::tm* (*time_converter)(const std::time_t*, std::tm*);
public:
typedef typename time_type::date_type date_type;
typedef typename time_type::time_duration_type time_duration_type;
@@ -49,7 +52,8 @@ namespace date_time {
//! return a local time object for the given zone, based on computer clock
//JKG -- looks like we could rewrite this against universal_time
template<class time_zone_type>
static time_type local_time(shared_ptr<time_zone_type> tz_ptr) {
static time_type local_time(shared_ptr<time_zone_type> tz_ptr)
{
typedef typename time_type::utc_time_type utc_time_type;
typedef second_clock<utc_time_type> second_clock;
// we'll need to know the utc_offset this machine has
@@ -62,137 +66,86 @@ namespace date_time {
return time_type(utc_time, tz_ptr);
}
private:
// we want this enum available for both platforms yet still private
enum TZ_FOR_CREATE { LOCAL, GMT };
public:
#ifdef BOOST_HAS_GETTIMEOFDAY
//! Return the local time based on computer clock settings
static time_type local_time() {
return create_time(LOCAL);
//! Returns the local time based on computer clock settings
static time_type local_time()
{
return create_time(&c_time::localtime);
}
//! Get the current day in universal date as a ymd_type
//! Returns the UTC time based on computer settings
static time_type universal_time()
{
return create_time(GMT);
return create_time(&c_time::gmtime);
}
private:
static time_type create_time(TZ_FOR_CREATE tz) {
static time_type create_time(time_converter converter)
{
#ifdef BOOST_HAS_GETTIMEOFDAY
timeval tv;
gettimeofday(&tv, 0); //gettimeofday does not support TZ adjust on Linux.
std::time_t t = tv.tv_sec;
boost::uint32_t fs = tv.tv_usec;
std::tm curr, *curr_ptr = 0;
if (tz == LOCAL) {
curr_ptr = c_time::localtime(&t, &curr);
} else {
curr_ptr = c_time::gmtime(&t, &curr);
boost::uint32_t sub_sec = tv.tv_usec;
#elif defined(BOOST_HAS_FTIME)
boost::winapi::FILETIME_ ft;
boost::winapi::GetSystemTimeAsFileTime(&ft);
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime functions.
{
boost::winapi::FILETIME_ local_ft;
boost::winapi::FileTimeToLocalFileTime(&ft, &local_ft);
ft = local_ft;
}
date_type d(curr_ptr->tm_year + 1900,
curr_ptr->tm_mon + 1,
curr_ptr->tm_mday);
//The following line will adjusts the fractional second tick in terms
#endif
boost::uint64_t micros = file_time_to_microseconds(ft); // it will not wrap, since ft is the current time
// and cannot be before 1970-Jan-01
std::time_t t = static_cast<std::time_t>(micros / 1000000UL); // seconds since epoch
// microseconds -- static casts suppress warnings
boost::uint32_t sub_sec = static_cast<boost::uint32_t>(micros % 1000000UL);
#else
#error Internal Boost.DateTime error: BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK is defined, however neither gettimeofday nor FILETIME support is detected.
#endif
std::tm curr;
std::tm* curr_ptr = converter(&t, &curr);
date_type d(static_cast< typename date_type::year_type::value_type >(curr_ptr->tm_year + 1900),
static_cast< typename date_type::month_type::value_type >(curr_ptr->tm_mon + 1),
static_cast< typename date_type::day_type::value_type >(curr_ptr->tm_mday));
//The following line will adjust the fractional second tick in terms
//of the current time system. For example, if the time system
//doesn't support fractional seconds then res_adjust returns 0
//and all the fractional seconds return 0.
int adjust = resolution_traits_type::res_adjust()/1000000;
int adjust = static_cast< int >(resolution_traits_type::res_adjust() / 1000000);
time_duration_type td(curr_ptr->tm_hour,
curr_ptr->tm_min,
curr_ptr->tm_sec,
fs*adjust);
return time_type(d,td);
}
#endif // BOOST_HAS_GETTIMEOFDAY
#ifdef BOOST_HAS_FTIME
//! Return the local time based on computer clock settings
static time_type local_time() {
FILETIME ft;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime.
FILETIME ft_utc;
GetSystemTimeAsFileTime(&ft_utc);
FileTimeToLocalFileTime(&ft_utc,&ft);
#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME)
SYSTEMTIME st;
GetSystemTime( &st );
SystemTimeToFileTime( &st, &ft );
#else
GetSystemTimeAsFileTime(&ft);
#endif
return create_time(ft, LOCAL);
}
//! Return the UTC time based on computer settings
static time_type universal_time() {
FILETIME ft;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
// Some runtime library implementations expect local times as the norm for ctime.
FILETIME ft_utc;
GetSystemTimeAsFileTime(&ft_utc);
FileTimeToLocalFileTime(&ft_utc,&ft);
#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME)
SYSTEMTIME st;
GetSystemTime( &st );
SystemTimeToFileTime( &st, &ft );
#else
GetSystemTimeAsFileTime(&ft);
#endif
return create_time(ft, GMT);
}
private:
static time_type create_time(FILETIME& ft, TZ_FOR_CREATE tz) {
// offset is difference (in 100-nanoseconds) from
// 1970-Jan-01 to 1601-Jan-01
boost::uint64_t c1 = 27111902;
boost::uint64_t c2 = 3577643008UL; // 'UL' removes compiler warnings
const boost::uint64_t OFFSET = (c1 << 32) + c2;
boost::uint64_t filetime = ft.dwHighDateTime;
filetime = filetime << 32;
filetime += ft.dwLowDateTime;
filetime -= OFFSET;
// filetime now holds 100-nanoseconds since 1970-Jan-01
// microseconds -- static casts supress warnings
boost::uint32_t sub_sec = static_cast<boost::uint32_t>((filetime % 10000000) / 10);
std::time_t t = static_cast<time_t>(filetime / 10000000); // seconds since epoch
std::tm curr, *curr_ptr = 0;
if (tz == LOCAL) {
curr_ptr = c_time::localtime(&t, &curr);
}
else {
curr_ptr = c_time::gmtime(&t, &curr);
}
date_type d(curr_ptr->tm_year + 1900,
curr_ptr->tm_mon + 1,
curr_ptr->tm_mday);
//The following line will adjusts the fractional second tick in terms
//of the current time system. For example, if the time system
//doesn't support fractional seconds then res_adjust returns 0
//and all the fractional seconds return 0.
int adjust = static_cast<int>(resolution_traits_type::res_adjust()/1000000);
time_duration_type td(curr_ptr->tm_hour,
curr_ptr->tm_min,
curr_ptr->tm_sec,
time_duration_type td(static_cast< typename time_duration_type::hour_type >(curr_ptr->tm_hour),
static_cast< typename time_duration_type::min_type >(curr_ptr->tm_min),
static_cast< typename time_duration_type::sec_type >(curr_ptr->tm_sec),
sub_sec * adjust);
//st.wMilliseconds * adjust);
return time_type(d,td);
return time_type(d,td);
}
#endif // BOOST_HAS_FTIME
#if defined(BOOST_HAS_FTIME)
/*!
* The function converts file_time into number of microseconds elapsed since 1970-Jan-01
*
* \note Only dates after 1970-Jan-01 are supported. Dates before will be wrapped.
*/
static boost::uint64_t file_time_to_microseconds(boost::winapi::FILETIME_ const& ft)
{
// shift is difference between 1970-Jan-01 & 1601-Jan-01
// in 100-nanosecond units
const boost::uint64_t shift = 116444736000000000ULL; // (27111902 << 32) + 3577643008
// 100-nanos since 1601-Jan-01
boost::uint64_t ft_as_integer = (static_cast< boost::uint64_t >(ft.dwHighDateTime) << 32) | static_cast< boost::uint64_t >(ft.dwLowDateTime);
ft_as_integer -= shift; // filetime is now 100-nanos since 1970-Jan-01
return (ft_as_integer / 10U); // truncate to microseconds
}
#endif
};
+48 -52
View File
@@ -17,7 +17,8 @@
*/
#include "boost/operators.hpp"
#include <boost/operators.hpp>
#include <boost/date_time/compiler_config.hpp>
namespace boost {
@@ -48,7 +49,7 @@ namespace date_time {
*/
template<class point_rep, class duration_rep>
class period : private
class BOOST_SYMBOL_VISIBLE period : private
boost::less_than_comparable<period<point_rep, duration_rep>
, boost::equality_comparable< period<point_rep, duration_rep>
> >
@@ -57,26 +58,26 @@ namespace date_time {
typedef point_rep point_type;
typedef duration_rep duration_type;
period(point_rep first_point, point_rep end_point);
period(point_rep first_point, duration_rep len);
point_rep begin() const;
point_rep end() const;
point_rep last() const;
duration_rep length() const;
bool is_null() const;
bool operator==(const period& rhs) const;
bool operator<(const period& rhs) const;
void shift(const duration_rep& d);
void expand(const duration_rep& d);
bool contains(const point_rep& point) const;
bool contains(const period& other) const;
bool intersects(const period& other) const;
bool is_adjacent(const period& other) const;
bool is_before(const point_rep& point) const;
bool is_after(const point_rep& point) const;
period intersection(const period& other) const;
period merge(const period& other) const;
period span(const period& other) const;
BOOST_CXX14_CONSTEXPR period(point_rep first_point, point_rep end_point);
BOOST_CXX14_CONSTEXPR period(point_rep first_point, duration_rep len);
BOOST_CXX14_CONSTEXPR point_rep begin() const;
BOOST_CXX14_CONSTEXPR point_rep end() const;
BOOST_CXX14_CONSTEXPR point_rep last() const;
BOOST_CXX14_CONSTEXPR duration_rep length() const;
BOOST_CXX14_CONSTEXPR bool is_null() const;
BOOST_CXX14_CONSTEXPR bool operator==(const period& rhs) const;
BOOST_CXX14_CONSTEXPR bool operator<(const period& rhs) const;
BOOST_CXX14_CONSTEXPR void shift(const duration_rep& d);
BOOST_CXX14_CONSTEXPR void expand(const duration_rep& d);
BOOST_CXX14_CONSTEXPR bool contains(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR bool contains(const period& other) const;
BOOST_CXX14_CONSTEXPR bool intersects(const period& other) const;
BOOST_CXX14_CONSTEXPR bool is_adjacent(const period& other) const;
BOOST_CXX14_CONSTEXPR bool is_before(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR bool is_after(const point_rep& point) const;
BOOST_CXX14_CONSTEXPR period intersection(const period& other) const;
BOOST_CXX14_CONSTEXPR period merge(const period& other) const;
BOOST_CXX14_CONSTEXPR period span(const period& other) const;
private:
point_rep begin_;
point_rep last_;
@@ -86,7 +87,7 @@ namespace date_time {
/*! If end <= begin then the period will be invalid
*/
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
period<point_rep,duration_rep>::period(point_rep first_point,
point_rep end_point) :
begin_(first_point),
@@ -97,7 +98,7 @@ namespace date_time {
/*! If len is <= 0 then the period will be invalid
*/
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
period<point_rep,duration_rep>::period(point_rep first_point, duration_rep len) :
begin_(first_point),
last_(first_point + len-duration_rep::unit())
@@ -106,7 +107,7 @@ namespace date_time {
//! Return the first element in the period
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
point_rep period<point_rep,duration_rep>::begin() const
{
return begin_;
@@ -114,7 +115,7 @@ namespace date_time {
//! Return one past the last element
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
point_rep period<point_rep,duration_rep>::end() const
{
return last_ + duration_rep::unit();
@@ -122,7 +123,7 @@ namespace date_time {
//! Return the last item in the period
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
point_rep period<point_rep,duration_rep>::last() const
{
return last_;
@@ -130,7 +131,7 @@ namespace date_time {
//! True if period is ill formed (length is zero or less)
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_null() const
{
return end() <= begin_;
@@ -138,7 +139,7 @@ namespace date_time {
//! Return the length of the period
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
duration_rep period<point_rep,duration_rep>::length() const
{
if(last_ < begin_){ // invalid period
@@ -151,7 +152,7 @@ namespace date_time {
//! Equality operator
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::operator==(const period& rhs) const
{
return ((begin_ == rhs.begin_) &&
@@ -160,7 +161,7 @@ namespace date_time {
//! Strict as defined by rhs.last <= lhs.last
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::operator<(const period& rhs) const
{
return (last_ < rhs.begin_);
@@ -169,7 +170,7 @@ namespace date_time {
//! Shift the start and end by the specified amount
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
void period<point_rep,duration_rep>::shift(const duration_rep& d)
{
begin_ = begin_ + d;
@@ -196,7 +197,7 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
void period<point_rep,duration_rep>::expand(const duration_rep& d)
{
begin_ = begin_ - d;
@@ -205,7 +206,7 @@ namespace date_time {
//! True if the point is inside the period, zero length periods contain no points
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::contains(const point_rep& point) const
{
return ((point >= begin_) &&
@@ -215,7 +216,7 @@ namespace date_time {
//! True if this period fully contains (or equals) the other period
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::contains(const period<point_rep,duration_rep>& other) const
{
return ((begin_ <= other.begin_) && (last_ >= other.last_));
@@ -232,9 +233,8 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
bool
period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const
{
return (other.begin() == end() ||
begin_ == other.end());
@@ -251,9 +251,8 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
bool
period<point_rep,duration_rep>::is_after(const point_rep& t) const
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_after(const point_rep& t) const
{
if (is_null())
{
@@ -273,9 +272,8 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
bool
period<point_rep,duration_rep>::is_before(const point_rep& t) const
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::is_before(const point_rep& t) const
{
if (is_null())
{
@@ -298,17 +296,15 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const
inline BOOST_CXX14_CONSTEXPR
bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const
{
return ( contains(other.begin_) ||
other.contains(begin_) ||
((other.begin_ < begin_) && (other.last_ >= begin_)));
return !is_null() && !other.is_null() && (begin_ < other.end()) && (other.begin_ < end());
}
//! Returns the period of intersection or invalid range no intersection
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
period<point_rep,duration_rep>
period<point_rep,duration_rep>::intersection(const period<point_rep,duration_rep>& other) const
{
@@ -333,7 +329,7 @@ namespace date_time {
/*!
*/
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
period<point_rep,duration_rep>
period<point_rep,duration_rep>::merge(const period<point_rep,duration_rep>& other) const
{
@@ -360,7 +356,7 @@ namespace date_time {
*@endcode
*/
template<class point_rep, class duration_rep>
inline
inline BOOST_CXX14_CONSTEXPR
period<point_rep,duration_rep>
period<point_rep,duration_rep>::span(const period<point_rep,duration_rep>& other) const
{
+40 -36
View File
@@ -3,14 +3,17 @@
#define DATETIME_PERIOD_FORMATTER_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include <iosfwd>
#include <string>
#include <vector>
#include <iterator>
namespace boost { namespace date_time {
@@ -19,14 +22,14 @@ namespace boost { namespace date_time {
/*! Provides settings for the following:
* - period_separator -- default '/'
* - period_open_start_delimeter -- default '['
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - display_as_open_range, display_as_closed_range -- default closed_range
*
* Thus the default formatting for a period is as follows:
*@code
* [period.start()/period.last()]
*@endcode
*@endcode
* So for a typical date_period this would be
*@code
* [2004-Jan-04/2004-Feb-01]
@@ -34,13 +37,13 @@ namespace boost { namespace date_time {
* where the date formatting is controlled by the date facet
*/
template <class CharT, class OutItrT = std::ostreambuf_iterator<CharT, std::char_traits<CharT> > >
class period_formatter {
class period_formatter {
public:
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef typename std::basic_string<char_type>::const_iterator const_itr_type;
typedef std::vector<std::basic_string<CharT> > collection_type;
static const char_type default_period_separator[2];
static const char_type default_period_start_delimeter[2];
static const char_type default_period_open_range_end_delimeter[2];
@@ -49,8 +52,8 @@ namespace boost { namespace date_time {
enum range_display_options { AS_OPEN_RANGE, AS_CLOSED_RANGE };
//! Constructor that sets up period formatter options -- default should suffice most cases.
period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
period_formatter(range_display_options range_option_in = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
const char_type* const period_start_delimeter = default_period_start_delimeter,
const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter,
const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter) :
@@ -62,7 +65,7 @@ namespace boost { namespace date_time {
{}
//! Puts the characters between period elements into stream -- default is /
OutItrT put_period_separator(OutItrT& oitr) const
OutItrT put_period_separator(OutItrT& oitr) const
{
const_itr_type ci = m_period_separator.begin();
while (ci != m_period_separator.end()) {
@@ -73,7 +76,7 @@ namespace boost { namespace date_time {
}
//! Puts the period start characters into stream -- default is [
OutItrT put_period_start_delimeter(OutItrT& oitr) const
OutItrT put_period_start_delimeter(OutItrT& oitr) const
{
const_itr_type ci = m_period_start_delimeter.begin();
while (ci != m_period_start_delimeter.end()) {
@@ -84,9 +87,9 @@ namespace boost { namespace date_time {
}
//! Puts the period end characters into stream as controled by open/closed range setting.
OutItrT put_period_end_delimeter(OutItrT& oitr) const
OutItrT put_period_end_delimeter(OutItrT& oitr) const
{
const_itr_type ci, end;
if (m_range_option == AS_OPEN_RANGE) {
ci = m_open_range_end_delimeter.begin();
@@ -102,40 +105,41 @@ namespace boost { namespace date_time {
}
return oitr;
}
range_display_options range_option() const
{
return m_range_option;
}
//! Reset the range_option control
void
void
range_option(range_display_options option) const
{
m_range_option = option;
}
//! Change the delimiter strings
void delimiter_strings(const string_type& separator,
const string_type& start_delim,
const string_type& open_end_delim,
const string_type& closed_end_delim)
{
m_period_separator;
m_period_start_delimeter;
m_open_range_end_delimeter;
m_closed_range_end_delimeter;
m_period_separator = separator;
m_period_start_delimeter = start_delim;
m_open_range_end_delimeter = open_end_delim;
m_closed_range_end_delimeter = closed_end_delim;
}
//! Generic code to output a period -- no matter the period type.
/*! This generic code will output any period using a facet to
* to output the 'elements'. For example, in the case of a date_period
* the elements will be instances of a date which will be formatted
* the elements will be instances of a date which will be formatted
* according the to setup in the passed facet parameter.
*
*
* The steps for formatting a period are always the same:
* - put the start delimiter
* - put start element
* - put the separator
* - put the separator
* - put either last or end element depending on range settings
* - put end delimeter depending on range settings
*
@@ -148,9 +152,9 @@ namespace boost { namespace date_time {
*@endcode
*/
template<class period_type, class facet_type>
OutItrT put_period(OutItrT next,
std::ios_base& a_ios,
char_type a_fill,
OutItrT put_period(OutItrT next,
std::ios_base& a_ios,
char_type a_fill,
const period_type& p,
const facet_type& facet) const {
put_period_start_delimeter(next);
@@ -166,29 +170,29 @@ namespace boost { namespace date_time {
return next;
}
private:
range_display_options m_range_option;
range_display_options m_range_option;
string_type m_period_separator;
string_type m_period_start_delimeter;
string_type m_open_range_end_delimeter;
string_type m_closed_range_end_delimeter;
};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_separator[2] = {'/'};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_start_delimeter[2] = {'['};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_open_range_end_delimeter[2] = {')'};
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
template <class CharT, class OutItrT>
const typename period_formatter<CharT, OutItrT>::char_type
period_formatter<CharT, OutItrT>::default_period_closed_range_end_delimeter[2] = {']'};
} } //namespace boost::date_time
+43 -42
View File
@@ -3,26 +3,32 @@
#define DATETIME_PERIOD_PARSER_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/string_parse_tree.hpp"
#include "boost/date_time/string_convert.hpp"
#include <ios>
#include <string>
#include <vector>
#include <iterator>
#include <boost/throw_exception.hpp>
#include <boost/date_time/special_defs.hpp>
#include <boost/date_time/string_parse_tree.hpp>
#include <boost/date_time/string_convert.hpp>
namespace boost { namespace date_time {
//! Not a facet, but a class used to specify and control period parsing
//! Not a facet, but a class used to specify and control period parsing
/*! Provides settings for the following:
* - period_separator -- default '/'
* - period_open_start_delimeter -- default '['
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - period_open_range_end_delimeter -- default ')'
* - period_closed_range_end_delimeter -- default ']'
* - display_as_open_range, display_as_closed_range -- default closed_range
*
* For a typical date_period, the contents of the input stream would be
@@ -32,7 +38,7 @@ namespace boost { namespace date_time {
* where the date format is controlled by the date facet
*/
template<class date_type, typename CharT>
class period_parser {
class period_parser {
public:
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
@@ -41,7 +47,7 @@ namespace boost { namespace date_time {
typedef string_parse_tree<CharT> parse_tree_type;
typedef typename parse_tree_type::parse_match_result_type match_results;
typedef std::vector<std::basic_string<CharT> > collection_type;
static const char_type default_period_separator[2];
static const char_type default_period_start_delimeter[2];
static const char_type default_period_open_range_end_delimeter[2];
@@ -50,12 +56,12 @@ namespace boost { namespace date_time {
enum period_range_option { AS_OPEN_RANGE, AS_CLOSED_RANGE };
//! Constructor that sets up period parser options
period_parser(period_range_option range_option = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
period_parser(period_range_option range_opt = AS_CLOSED_RANGE,
const char_type* const period_separator = default_period_separator,
const char_type* const period_start_delimeter = default_period_start_delimeter,
const char_type* const period_open_range_end_delimeter = default_period_open_range_end_delimeter,
const char_type* const period_closed_range_end_delimeter = default_period_closed_range_end_delimeter)
: m_range_option(range_option)
: m_range_option(range_opt)
{
delimiters.push_back(string_type(period_separator));
delimiters.push_back(string_type(period_start_delimeter));
@@ -63,12 +69,6 @@ namespace boost { namespace date_time {
delimiters.push_back(string_type(period_closed_range_end_delimeter));
}
period_parser(const period_parser<date_type,CharT>& p_parser)
{
this->delimiters = p_parser.delimiters;
this->m_range_option = p_parser.m_range_option;
}
period_range_option range_option() const
{
return m_range_option;
@@ -98,11 +98,11 @@ namespace boost { namespace date_time {
* to get the 'elements'. For example, in the case of a date_period
* the elements will be instances of a date which will be parsed
* according the to setup in the passed facet parameter.
*
*
* The steps for parsing a period are always the same:
* - consume the start delimiter
* - get start element
* - consume the separator
* - consume the separator
* - get either last or end element depending on range settings
* - consume the end delimeter depending on range settings
*
@@ -116,16 +116,16 @@ namespace boost { namespace date_time {
*@endcode
*/
template<class period_type, class duration_type, class facet_type>
period_type get_period(stream_itr_type& sitr,
period_type get_period(stream_itr_type& sitr,
stream_itr_type& stream_end,
std::ios_base& a_ios,
const period_type& p,
std::ios_base& a_ios,
const period_type& /* p */,
const duration_type& dur_unit,
const facet_type& facet) const
const facet_type& facet) const
{
// skip leading whitespace
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; }
typedef typename period_type::point_type point_type;
point_type p1(not_a_date_time), p2(not_a_date_time);
@@ -144,14 +144,14 @@ namespace boost { namespace date_time {
else {
consume_delim(sitr, stream_end, delimiters[OPEN_END]); // end delim
}
return period_type(p1, p2);
}
private:
collection_type delimiters;
period_range_option m_range_option;
collection_type delimiters;
period_range_option m_range_option;
enum delim_ids { SEPARATOR, START, OPEN_END, CLOSED_END };
//! throws ios_base::failure if delimiter and parsed data do not match
@@ -159,10 +159,10 @@ namespace boost { namespace date_time {
stream_itr_type& stream_end,
const string_type& delim) const
{
/* string_parse_tree will not parse a string of punctuation characters
/* string_parse_tree will not parse a string of punctuation characters
* without knowing exactly how many characters to process
* Ex [2000. Will not parse out the '[' string without knowing
* to process only one character. By using length of the delimiter
* Ex [2000. Will not parse out the '[' string without knowing
* to process only one character. By using length of the delimiter
* string we can safely iterate past it. */
string_type s;
for(unsigned int i = 0; i < delim.length() && sitr != stream_end; ++i) {
@@ -170,25 +170,26 @@ namespace boost { namespace date_time {
++sitr;
}
if(s != delim) {
throw std::ios_base::failure("Parse failed. Expected '" + convert_string_type<char_type,char>(delim) + "' but found '" + convert_string_type<char_type,char>(s) + "'");
boost::throw_exception(std::ios_base::failure("Parse failed. Expected '"
+ convert_string_type<char_type,char>(delim) + "' but found '" + convert_string_type<char_type,char>(s) + "'"));
}
}
};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_separator[2] = {'/'};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_start_delimeter[2] = {'['};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_open_range_end_delimeter[2] = {')'};
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
template <class date_type, class char_type>
const typename period_parser<date_type, char_type>::char_type
period_parser<date_type, char_type>::default_period_closed_range_end_delimeter[2] = {']'};
} } //namespace boost::date_time
@@ -2,56 +2,59 @@
#define POSIX_TIME_CONVERSION_HPP___
/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/posix_time/ptime.hpp"
#include "boost/date_time/posix_time/posix_time_duration.hpp"
#include "boost/date_time/filetime_functions.hpp"
#include "boost/date_time/c_time.hpp"
#include "boost/date_time/gregorian/conversion.hpp"
#include <cstring>
#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/date_time/filetime_functions.hpp>
#include <boost/date_time/c_time.hpp>
#include <boost/date_time/time_resolution_traits.hpp> // absolute_value
#include <boost/date_time/gregorian/conversion.hpp>
namespace boost {
namespace posix_time {
//! Function that converts a time_t into a ptime.
inline
ptime from_time_t(std::time_t t)
ptime from_time_t(std::time_t t)
{
ptime start(gregorian::date(1970,1,1));
return start + seconds(static_cast<long>(t));
return ptime(gregorian::date(1970,1,1)) + seconds(t);
}
//! Convert a time to a tm structure truncating any fractional seconds
//! Function that converts a ptime into a time_t
inline
std::time_t to_time_t(ptime pt)
{
return (pt - ptime(gregorian::date(1970,1,1))).total_seconds();
}
//! Convert a time to a tm structure truncating any fractional seconds
inline
std::tm to_tm(const boost::posix_time::ptime& t) {
std::tm timetm = boost::gregorian::to_tm(t.date());
boost::posix_time::time_duration td = t.time_of_day();
timetm.tm_hour = td.hours();
timetm.tm_min = td.minutes();
timetm.tm_sec = td.seconds();
timetm.tm_isdst = -1; // -1 used when dst info is unknown
timetm.tm_hour = static_cast<int>(td.hours());
timetm.tm_min = static_cast<int>(td.minutes());
timetm.tm_sec = static_cast<int>(td.seconds());
timetm.tm_isdst = -1; // -1 used when dst info is unknown
return timetm;
}
//! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components
//! Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components
inline
std::tm to_tm(const boost::posix_time::time_duration& td) {
std::tm timetm;
timetm.tm_year = 0;
timetm.tm_mon = 0;
timetm.tm_mday = 0;
timetm.tm_wday = 0;
timetm.tm_yday = 0;
timetm.tm_hour = date_time::absolute_value(td.hours());
timetm.tm_min = date_time::absolute_value(td.minutes());
timetm.tm_sec = date_time::absolute_value(td.seconds());
std::memset(&timetm, 0, sizeof(timetm));
timetm.tm_hour = static_cast<int>(date_time::absolute_value(td.hours()));
timetm.tm_min = static_cast<int>(date_time::absolute_value(td.minutes()));
timetm.tm_sec = static_cast<int>(date_time::absolute_value(td.seconds()));
timetm.tm_isdst = -1; // -1 used when dst info is unknown
return timetm;
}
@@ -65,21 +68,25 @@ namespace posix_time {
#if defined(BOOST_HAS_FTIME)
//! Function to create a time object from an initialized FILETIME struct.
/*! Function to create a time object from an initialized FILETIME struct.
* A FILETIME struct holds 100-nanosecond units (0.0000001). When
* built with microsecond resolution the FILETIME's sub second value
* will be truncated. Nanosecond resolution has no truncation.
* A FILETIME struct holds 100-nanosecond units (0.0000001). When
* built with microsecond resolution the FILETIME's sub second value
* will be truncated. Nanosecond resolution has no truncation.
*
* Note ftime is part of the Win32 API, so it is not portable to non-windows
* \note FILETIME is part of the Win32 API, so it is not portable to non-windows
* platforms.
*
* \note The function is templated on the FILETIME type, so that
* it can be used with both native FILETIME and the ad-hoc
* boost::detail::winapi::FILETIME_ type.
*/
template<class time_type>
template< typename TimeT, typename FileTimeT >
inline
time_type from_ftime(const FILETIME& ft)
TimeT from_ftime(const FileTimeT& ft)
{
return boost::date_time::time_from_ftime<time_type>(ft);
return boost::date_time::time_from_ftime<TimeT>(ft);
}
#endif // BOOST_HAS_FTIME
@@ -1,6 +1,6 @@
#ifndef DATE_DURATION_OPERATORS_HPP___
#define DATE_DURATION_OPERATORS_HPP___
/* Copyright (c) 2004 CrystalClear Software, Inc.
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or
@@ -26,7 +26,7 @@ namespace posix_time {
/*! Adds a months object and a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator+(const ptime& t, const boost::gregorian::months& m)
{
@@ -36,7 +36,7 @@ namespace posix_time {
/*! Adds a months object to a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator+=(ptime& t, const boost::gregorian::months& m)
{
@@ -47,7 +47,7 @@ namespace posix_time {
/*! Subtracts a months object and a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator-(const ptime& t, const boost::gregorian::months& m)
{
@@ -58,7 +58,7 @@ namespace posix_time {
/*! Subtracts a months object from a ptime. Result will be same
* day-of-month as ptime unless original day was the last day of month.
* see date_time::months_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator-=(ptime& t, const boost::gregorian::months& m)
{
@@ -70,7 +70,7 @@ namespace posix_time {
/*! Adds a years object and a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator+(const ptime& t, const boost::gregorian::years& y)
{
@@ -80,7 +80,7 @@ namespace posix_time {
/*! Adds a years object to a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator+=(ptime& t, const boost::gregorian::years& y)
{
@@ -90,7 +90,7 @@ namespace posix_time {
/*! Subtracts a years object and a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator-(const ptime& t, const boost::gregorian::years& y)
{
@@ -101,7 +101,7 @@ namespace posix_time {
/*! Subtracts a years object from a ptime. Result will be same
* month and day-of-month as ptime unless original day was the
* last day of month. see date_time::years_duration for more details */
inline
inline BOOST_CXX14_CONSTEXPR
ptime
operator-=(ptime& t, const boost::gregorian::years& y)
{
@@ -1,60 +1,47 @@
#ifndef POSIX_TIME_CONFIG_HPP___
#define POSIX_TIME_CONFIG_HPP___
/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
/* Copyright (c) 2002,2003,2005,2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/time_duration.hpp"
#include "boost/date_time/time_resolution_traits.hpp"
#include "boost/date_time/gregorian/gregorian_types.hpp"
#include "boost/date_time/wrapping_int.hpp"
#include "boost/limits.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/cstdint.hpp"
#include <boost/config/no_tr1/cmath.hpp>
#include <cstdlib> //for MCW 7.2 std::abs(long long)
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/date_time/time_duration.hpp>
#include <boost/date_time/time_resolution_traits.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/wrapping_int.hpp>
#include <boost/date_time/compiler_config.hpp>
namespace boost {
namespace posix_time {
//Remove the following line if you want 64 bit millisecond resolution time
//#define BOOST_GDTL_POSIX_TIME_STD_CONFIG
#ifdef BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG
// set up conditional test compilations
#define BOOST_DATE_TIME_HAS_MILLISECONDS
#define BOOST_DATE_TIME_HAS_MICROSECONDS
#define BOOST_DATE_TIME_HAS_NANOSECONDS
typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano,
typedef date_time::time_resolution_traits<boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::nano,
1000000000, 9 > time_res_traits;
#else
// set up conditional test compilations
#define BOOST_DATE_TIME_HAS_MILLISECONDS
#define BOOST_DATE_TIME_HAS_MICROSECONDS
#undef BOOST_DATE_TIME_HAS_NANOSECONDS
typedef date_time::time_resolution_traits<
boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro,
boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro,
1000000, 6 > time_res_traits;
// #undef BOOST_DATE_TIME_HAS_MILLISECONDS
// #undef BOOST_DATE_TIME_HAS_MICROSECONDS
// #undef BOOST_DATE_TIME_HAS_NANOSECONDS
// typedef date_time::time_resolution_traits<boost::int64_t, boost::date_time::tenth,
// 10, 0 > time_res_traits;
#endif
//! Base time duration type
/*! \ingroup time_basics
*/
class time_duration :
class BOOST_SYMBOL_VISIBLE time_duration :
public date_time::time_duration<time_duration, time_res_traits>
{
public:
@@ -66,24 +53,24 @@ namespace posix_time {
typedef time_res_traits::fractional_seconds_type fractional_seconds_type;
typedef time_res_traits::tick_type tick_type;
typedef time_res_traits::impl_type impl_type;
time_duration(hour_type hour,
min_type min,
sec_type sec,
fractional_seconds_type fs=0) :
BOOST_CXX14_CONSTEXPR time_duration(hour_type hour,
min_type min,
sec_type sec,
fractional_seconds_type fs=0) :
date_time::time_duration<time_duration, time_res_traits>(hour,min,sec,fs)
{}
time_duration() :
BOOST_CXX14_CONSTEXPR time_duration() :
date_time::time_duration<time_duration, time_res_traits>(0,0,0)
{}
//! Construct from special_values
time_duration(boost::date_time::special_values sv) :
BOOST_CXX14_CONSTEXPR time_duration(boost::date_time::special_values sv) :
date_time::time_duration<time_duration, time_res_traits>(sv)
{}
//Give duration access to ticks constructor -- hide from users
friend class date_time::time_duration<time_duration, time_res_traits>;
private:
explicit time_duration(impl_type ticks) :
date_time::time_duration<time_duration, time_res_traits>(ticks)
protected:
BOOST_CXX14_CONSTEXPR explicit time_duration(impl_type tick_count) :
date_time::time_duration<time_duration, time_res_traits>(tick_count)
{}
};
@@ -94,7 +81,7 @@ namespace posix_time {
{
typedef gregorian::date date_type;
typedef time_duration time_duration_type;
simple_time_rep(date_type d, time_duration_type tod) :
BOOST_CXX14_CONSTEXPR simple_time_rep(date_type d, time_duration_type tod) :
day(d),
time_of_day(tod)
{
@@ -116,25 +103,25 @@ namespace posix_time {
}
date_type day;
time_duration_type time_of_day;
bool is_special()const
BOOST_CXX14_CONSTEXPR bool is_special()const
{
return(is_pos_infinity() || is_neg_infinity() || is_not_a_date_time());
}
bool is_pos_infinity()const
BOOST_CXX14_CONSTEXPR bool is_pos_infinity()const
{
return(day.is_pos_infinity() || time_of_day.is_pos_infinity());
}
bool is_neg_infinity()const
BOOST_CXX14_CONSTEXPR bool is_neg_infinity()const
{
return(day.is_neg_infinity() || time_of_day.is_neg_infinity());
}
bool is_not_a_date_time()const
BOOST_CXX14_CONSTEXPR bool is_not_a_date_time()const
{
return(day.is_not_a_date() || time_of_day.is_not_a_date_time());
}
};
class posix_time_system_config
class BOOST_SYMBOL_VISIBLE posix_time_system_config
{
public:
typedef simple_time_rep time_rep_type;
@@ -143,7 +130,7 @@ namespace posix_time {
typedef time_duration time_duration_type;
typedef time_res_traits::tick_type int_type;
typedef time_res_traits resolution_traits;
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
#else
BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000000);
#endif
@@ -151,7 +138,7 @@ namespace posix_time {
#else
class millisec_posix_time_system_config
class millisec_posix_time_system_config
{
public:
typedef boost::int64_t time_rep_type;
@@ -162,7 +149,7 @@ namespace posix_time {
typedef time_res_traits::tick_type int_type;
typedef time_res_traits::impl_type impl_type;
typedef time_res_traits resolution_traits;
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
#if (defined(BOOST_DATE_TIME_NO_MEMBER_INIT)) //help bad compilers
#else
BOOST_STATIC_CONSTANT(boost::int64_t, tick_per_second = 1000000);
#endif
@@ -1,7 +1,7 @@
#ifndef POSIX_TIME_DURATION_HPP___
#define POSIX_TIME_DURATION_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
/* Copyright (c) 2002,2003, 2020 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
@@ -9,41 +9,54 @@
* $Date$
*/
#include "boost/date_time/posix_time/posix_time_config.hpp"
#include <boost/core/enable_if.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/posix_time/posix_time_config.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/type_traits/is_integral.hpp>
namespace boost {
namespace posix_time {
//! Allows expression of durations as an hour count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class hours : public time_duration
class BOOST_SYMBOL_VISIBLE hours : public time_duration
{
public:
explicit hours(long h) :
time_duration(h,0,0)
template <typename T>
BOOST_CXX14_CONSTEXPR explicit hours(T const& h,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(numeric_cast<hour_type>(h), 0, 0)
{}
};
//! Allows expression of durations as a minute count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class minutes : public time_duration
class BOOST_SYMBOL_VISIBLE minutes : public time_duration
{
public:
explicit minutes(long m) :
time_duration(0,m,0)
template <typename T>
BOOST_CXX14_CONSTEXPR explicit minutes(T const& m,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(0, numeric_cast<min_type>(m),0)
{}
};
//! Allows expression of durations as a seconds count
//! The argument must be an integral type
/*! \ingroup time_basics
*/
class seconds : public time_duration
class BOOST_SYMBOL_VISIBLE seconds : public time_duration
{
public:
explicit seconds(long s) :
time_duration(0,0,s)
template <typename T>
BOOST_CXX14_CONSTEXPR explicit seconds(T const& s,
typename boost::enable_if<boost::is_integral<T>, void>::type* = BOOST_DATE_TIME_NULLPTR) :
time_duration(0,0, numeric_cast<sec_type>(s))
{}
};
@@ -69,12 +82,8 @@ namespace posix_time {
typedef date_time::subsecond_duration<time_duration,1000000000> nanosec;
typedef date_time::subsecond_duration<time_duration,1000000000> nanoseconds;
#endif
} }//namespace posix_time
@@ -9,14 +9,16 @@
* $Date$
*/
#include "boost/date_time/time_facet.hpp"
#include "boost/date_time/period_formatter.hpp"
#include "boost/date_time/posix_time/time_period.hpp"
#include "boost/date_time/posix_time/posix_time_duration.hpp"
//#include "boost/date_time/gregorian/gregorian_io.hpp"
#include "boost/io/ios_state.hpp"
#include <iostream>
#include <locale>
#include <iostream>
#include <iterator> // i/ostreambuf_iterator
#include <boost/io/ios_state.hpp>
#include <boost/date_time/time_facet.hpp>
#include <boost/date_time/period_formatter.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/date_time/posix_time/time_period.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/date_time/posix_time/conversion.hpp> // to_tm will be needed in the facets
namespace boost {
namespace posix_time {
@@ -39,13 +41,12 @@ namespace posix_time {
typedef boost::date_time::time_input_facet<ptime, char> time_input_facet;
template <class CharT, class TraitsT>
inline
inline
std::basic_ostream<CharT, TraitsT>&
operator<<(std::basic_ostream<CharT, TraitsT>& os,
operator<<(std::basic_ostream<CharT, TraitsT>& os,
const ptime& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_ptime_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc()))
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), p);
@@ -55,7 +56,6 @@ namespace posix_time {
//since we would always need to reconstruct for every time period
//if the locale did not already exist. Of course this will be overridden
//if the user imbues as some later point.
std::ostreambuf_iterator<CharT> oitr(os);
custom_ptime_facet* f = new custom_ptime_facet();
std::locale l = std::locale(os.getloc(), f);
os.imbue(l);
@@ -71,51 +71,48 @@ namespace posix_time {
operator>>(std::basic_istream<CharT, Traits>& is, ptime& pt)
{
boost::io::ios_flags_saver iflags(is);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, pt);
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, pt);
}
else {
time_input_facet* f = new time_input_facet();
time_input_facet_local* f = new time_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, pt);
}
}
catch(...) {
catch(...) {
// mask tells us what exceptions are turned on
std::ios_base::iostate exception_mask = is.exceptions();
// if the user wants exceptions on failbit, we'll rethrow our
// date_time exception & set the failbit
if(std::ios_base::failbit & exception_mask) {
try { is.setstate(std::ios_base::failbit); }
try { is.setstate(std::ios_base::failbit); }
catch(std::ios_base::failure&) {} // ignore this one
throw; // rethrow original exception
}
else {
// if the user want's to fail quietly, we simply set the failbit
is.setstate(std::ios_base::failbit);
}
// if the user wants to fail quietly, we simply set the failbit
is.setstate(std::ios_base::failbit);
}
}
}
return is;
}
template <class CharT, class TraitsT>
inline
std::basic_ostream<CharT, TraitsT>&
operator<<(std::basic_ostream<CharT, TraitsT>& os,
operator<<(std::basic_ostream<CharT, TraitsT>& os,
const boost::posix_time::time_period& p) {
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_time_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc())) {
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), p);
@@ -126,7 +123,6 @@ namespace posix_time {
//since we would always need to reconstruct for every time period
//if the local did not already exist. Of course this will be overridden
//if the user imbues as some later point.
std::ostreambuf_iterator<CharT> oitr(os);
custom_ptime_facet* f = new custom_ptime_facet();
std::locale l = std::locale(os.getloc(), f);
os.imbue(l);
@@ -142,38 +138,36 @@ namespace posix_time {
operator>>(std::basic_istream<CharT, Traits>& is, time_period& tp)
{
boost::io::ios_flags_saver iflags(is);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, tp);
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, tp);
}
else {
time_input_facet* f = new time_input_facet();
time_input_facet_local* f = new time_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, tp);
}
}
catch(...) {
catch(...) {
std::ios_base::iostate exception_mask = is.exceptions();
if(std::ios_base::failbit & exception_mask) {
try { is.setstate(std::ios_base::failbit); }
try { is.setstate(std::ios_base::failbit); }
catch(std::ios_base::failure&) {}
throw; // rethrow original exception
}
else {
is.setstate(std::ios_base::failbit);
}
is.setstate(std::ios_base::failbit);
}
}
}
return is;
}
//! ostream operator for posix_time::time_duration
// todo fix to use facet -- place holder for now...
@@ -184,7 +178,6 @@ namespace posix_time {
{
boost::io::ios_flags_saver iflags(os);
typedef boost::date_time::time_facet<ptime, CharT> custom_ptime_facet;
typedef std::time_put<CharT> std_ptime_facet;
std::ostreambuf_iterator<CharT> oitr(os);
if (std::has_facet<custom_ptime_facet>(os.getloc()))
std::use_facet<custom_ptime_facet>(os.getloc()).put(oitr, os, os.fill(), td);
@@ -194,7 +187,6 @@ namespace posix_time {
//since we would always need to reconstruct for every time period
//if the locale did not already exist. Of course this will be overridden
//if the user imbues as some later point.
std::ostreambuf_iterator<CharT> oitr(os);
custom_ptime_facet* f = new custom_ptime_facet();
std::locale l = std::locale(os.getloc(), f);
os.imbue(l);
@@ -210,37 +202,35 @@ namespace posix_time {
operator>>(std::basic_istream<CharT, Traits>& is, time_duration& td)
{
boost::io::ios_flags_saver iflags(is);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
typename std::basic_istream<CharT, Traits>::sentry strm_sentry(is, false);
if (strm_sentry) {
try {
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet;
typedef typename date_time::time_input_facet<ptime, CharT> time_input_facet_local;
std::istreambuf_iterator<CharT,Traits> sit(is), str_end;
if(std::has_facet<time_input_facet>(is.getloc())) {
std::use_facet<time_input_facet>(is.getloc()).get(sit, str_end, is, td);
if(std::has_facet<time_input_facet_local>(is.getloc())) {
std::use_facet<time_input_facet_local>(is.getloc()).get(sit, str_end, is, td);
}
else {
time_input_facet* f = new time_input_facet();
time_input_facet_local* f = new time_input_facet_local();
std::locale l = std::locale(is.getloc(), f);
is.imbue(l);
f->get(sit, str_end, is, td);
}
}
catch(...) {
catch(...) {
std::ios_base::iostate exception_mask = is.exceptions();
if(std::ios_base::failbit & exception_mask) {
try { is.setstate(std::ios_base::failbit); }
try { is.setstate(std::ios_base::failbit); }
catch(std::ios_base::failure&) {}
throw; // rethrow original exception
}
else {
is.setstate(std::ios_base::failbit);
}
is.setstate(std::ios_base::failbit);
}
}
}
return is;
}
} } // namespaces
#endif // DATE_TIME_POSIX_TIME_IO_HPP__
@@ -80,7 +80,7 @@ namespace posix_time {
// any marker (such as '\0').
typename std::basic_string<charT>::iterator e = inp_s.end();
while(b != e){
out_ss << out_ss.narrow(*b, 0);
out_ss << is.narrow(*b, 0);
++b;
}
+28 -9
View File
@@ -9,8 +9,9 @@
* $Date$
*/
#include "boost/date_time/posix_time/posix_time_system.hpp"
#include "boost/date_time/time.hpp"
#include <boost/date_time/posix_time/posix_time_system.hpp>
#include <boost/date_time/time.hpp>
#include <boost/date_time/compiler_config.hpp>
namespace boost {
@@ -24,11 +25,11 @@ namespace posix_time {
using date_time::not_a_date_time;
using date_time::max_date_time;
using date_time::min_date_time;
//! Time type with no timezone or other adjustments
/*! \ingroup time_basics
*/
class ptime : public date_time::base_time<ptime, posix_time_system>
class BOOST_SYMBOL_VISIBLE ptime : public date_time::base_time<ptime, posix_time_system>
{
public:
typedef posix_time_system time_system_type;
@@ -36,26 +37,44 @@ namespace posix_time {
typedef time_system_type::time_duration_type time_duration_type;
typedef ptime time_type;
//! Construct with date and offset in day
ptime(gregorian::date d,time_duration_type td) : date_time::base_time<time_type,time_system_type>(d,td)
BOOST_CXX14_CONSTEXPR
ptime(gregorian::date d,time_duration_type td) :
date_time::base_time<time_type,time_system_type>(d,td)
{}
//! Construct a time at start of the given day (midnight)
explicit ptime(gregorian::date d) : date_time::base_time<time_type,time_system_type>(d,time_duration_type(0,0,0))
BOOST_CXX14_CONSTEXPR
explicit ptime(gregorian::date d) :
date_time::base_time<time_type,time_system_type>(d,time_duration_type(0,0,0))
{}
//! Copy from time_rep
BOOST_CXX14_CONSTEXPR
ptime(const time_rep_type& rhs):
date_time::base_time<time_type,time_system_type>(rhs)
{}
//! Construct from special value
ptime(const special_values sv) : date_time::base_time<time_type,time_system_type>(sv)
BOOST_CXX14_CONSTEXPR
ptime(const special_values sv) :
date_time::base_time<time_type,time_system_type>(sv)
{}
#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR)
// Default constructor constructs to not_a_date_time
ptime() : date_time::base_time<time_type,time_system_type>(gregorian::date(not_a_date_time), time_duration_type(not_a_date_time))
BOOST_CXX14_CONSTEXPR
ptime() :
date_time::base_time<time_type,time_system_type>(gregorian::date(not_a_date_time),
time_duration_type(not_a_date_time))
{}
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
friend BOOST_CXX14_CONSTEXPR
bool operator==(const ptime& lhs, const ptime& rhs);
};
inline BOOST_CXX14_CONSTEXPR
bool operator==(const ptime& lhs, const ptime& rhs)
{
return ptime::time_system_type::is_equal(lhs.time_,rhs.time_);
}
} }//namespace posix_time
@@ -2,24 +2,24 @@
#define POSIXTIME_FORMATTERS_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/date_format_simple.hpp"
#include "boost/date_time/posix_time/posix_time_types.hpp"
#include "boost/date_time/time_formatting_streams.hpp"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/iso_format.hpp>
#include <boost/date_time/date_format_simple.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/time_formatting_streams.hpp>
#include <boost/date_time/time_resolution_traits.hpp> // absolute_value
#include <boost/date_time/time_parsing.hpp>
#include "boost/date_time/time_parsing.hpp"
/* NOTE: The "to_*_string" code for older compilers, ones that define
* BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in
/* NOTE: The "to_*_string" code for older compilers, ones that define
* BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in
* formatters_limited.hpp
*/
@@ -57,27 +57,27 @@ namespace posix_time {
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.hours()) << ":";
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.minutes()) << ":";
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
boost::int64_t frac_sec =
boost::int64_t frac_sec =
date_time::absolute_value(td.fractional_seconds());
// JDG [7/6/02 VC++ compatibility]
charT buff[32];
_i64toa(frac_sec, buff, 10);
#else
time_duration::fractional_seconds_type frac_sec =
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill(fill_char)
// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
<< buff;
@@ -99,7 +99,7 @@ namespace posix_time {
// template function called by wrapper functions:
// to_*_string(time_duration) & to_*_wstring(time_duration)
template<class charT>
inline std::basic_string<charT> to_iso_string_type(time_duration td)
inline std::basic_string<charT> to_iso_string_type(time_duration td)
{
std::basic_ostringstream<charT> ss;
if(td.is_special()) {
@@ -126,27 +126,27 @@ namespace posix_time {
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.hours());
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.minutes());
ss << std::setw(2) << std::setfill(fill_char)
ss << std::setw(2) << std::setfill(fill_char)
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
boost::int64_t frac_sec =
boost::int64_t frac_sec =
date_time::absolute_value(td.fractional_seconds());
// JDG [7/6/02 VC++ compatibility]
charT buff[32];
_i64toa(frac_sec, buff, 10);
#else
time_duration::fractional_seconds_type frac_sec =
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill(fill_char)
// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
<< buff;
@@ -157,7 +157,7 @@ namespace posix_time {
}// else
return ss.str();
}
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
/*!\ingroup time_format
*/
inline std::string to_iso_string(time_duration td){
@@ -168,7 +168,7 @@ namespace posix_time {
/*!\ingroup time_format
*/
template<class charT>
inline std::basic_string<charT> to_simple_string_type(ptime t)
inline std::basic_string<charT> to_simple_string_type(ptime t)
{
// can't use this w/gcc295, no to_simple_string_type<>(td) available
std::basic_string<charT> ts = gregorian::to_simple_string_type<charT>(t.date());// + " ";
@@ -184,10 +184,10 @@ namespace posix_time {
return to_simple_string_type<char>(t);
}
// function called by wrapper functions to_*_string(time_period)
// function called by wrapper functions to_*_string(time_period)
// & to_*_wstring(time_period)
template<class charT>
inline std::basic_string<charT> to_simple_string_type(time_period tp)
inline std::basic_string<charT> to_simple_string_type(time_period tp)
{
charT beg = '[', mid = '/', end = ']';
std::basic_string<charT> d1(to_simple_string_type<charT>(tp.begin()));
@@ -201,10 +201,10 @@ namespace posix_time {
return to_simple_string_type<char>(tp);
}
// function called by wrapper functions to_*_string(time_period)
// function called by wrapper functions to_*_string(time_period)
// & to_*_wstring(time_period)
template<class charT>
inline std::basic_string<charT> to_iso_string_type(ptime t)
inline std::basic_string<charT> to_iso_string_type(ptime t)
{
std::basic_string<charT> ts = gregorian::to_iso_string_type<charT>(t.date());// + "T";
if(!t.time_of_day().is_special()) {
@@ -215,7 +215,7 @@ namespace posix_time {
return ts;
}
}
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline std::string to_iso_string(ptime t){
@@ -223,10 +223,10 @@ namespace posix_time {
}
// function called by wrapper functions to_*_string(time_period)
// function called by wrapper functions to_*_string(time_period)
// & to_*_wstring(time_period)
template<class charT>
inline std::basic_string<charT> to_iso_extended_string_type(ptime t)
inline std::basic_string<charT> to_iso_extended_string_type(ptime t)
{
std::basic_string<charT> ts = gregorian::to_iso_extended_string_type<charT>(t.date());// + "T";
if(!t.time_of_day().is_special()) {
@@ -251,7 +251,7 @@ namespace posix_time {
inline std::wstring to_simple_wstring(time_duration td) {
return to_simple_string_type<wchar_t>(td);
}
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
/*!\ingroup time_format
*/
inline std::wstring to_iso_wstring(time_duration td){
@@ -266,7 +266,7 @@ namespace posix_time {
inline std::wstring to_simple_wstring(time_period tp){
return to_simple_string_type<wchar_t>(tp);
}
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline std::wstring to_iso_wstring(ptime t){
@@ -2,20 +2,21 @@
#define POSIXTIME_FORMATTERS_LIMITED_HPP___
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date$
*/
#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/iso_format.hpp"
#include "boost/date_time/date_format_simple.hpp"
#include "boost/date_time/posix_time/posix_time_types.hpp"
#include "boost/date_time/time_formatting_streams.hpp"
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/compiler_config.hpp>
#include <boost/date_time/iso_format.hpp>
#include <boost/date_time/date_format_simple.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/time_formatting_streams.hpp>
#include <boost/date_time/time_resolution_traits.hpp> // absolute_value
namespace boost {
namespace posix_time {
@@ -49,27 +50,27 @@ namespace posix_time {
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.hours()) << ":";
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.minutes()) << ":";
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
boost::int64_t frac_sec =
boost::int64_t frac_sec =
date_time::absolute_value(td.fractional_seconds());
// JDG [7/6/02 VC++ compatibility]
char buff[32];
_i64toa(frac_sec, buff, 10);
#else
time_duration::fractional_seconds_type frac_sec =
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill('0')
// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
<< buff;
@@ -81,12 +82,12 @@ namespace posix_time {
return ss.str();
}
//! Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456
//! Time duration in ISO 8601 format -hhmmss.fffffff. Example: 10:09:03.0123456
/*!\ingroup time_format
*/
inline
std::string
to_iso_string(time_duration td)
inline
std::string
to_iso_string(time_duration td)
{
std::ostringstream ss;
if(td.is_special()) {
@@ -112,27 +113,27 @@ namespace posix_time {
if(td.is_negative()) {
ss << '-';
}
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.hours());
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.minutes());
ss << std::setw(2) << std::setfill('0')
ss << std::setw(2) << std::setfill('0')
<< date_time::absolute_value(td.seconds());
//TODO the following is totally non-generic, yelling FIXME
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
boost::int64_t frac_sec =
boost::int64_t frac_sec =
date_time::absolute_value(td.fractional_seconds());
// JDG [7/6/02 VC++ compatibility]
char buff[32];
_i64toa(frac_sec, buff, 10);
#else
time_duration::fractional_seconds_type frac_sec =
time_duration::fractional_seconds_type frac_sec =
date_time::absolute_value(td.fractional_seconds());
#endif
if (frac_sec != 0) {
ss << "." << std::setw(time_duration::num_fractional_digits())
<< std::setfill('0')
// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER < 1300))
<< buff;
@@ -147,9 +148,9 @@ namespace posix_time {
//! Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff
/*!\ingroup time_format
*/
inline
std::string
to_simple_string(ptime t)
inline
std::string
to_simple_string(ptime t)
{
std::string ts = gregorian::to_simple_string(t.date());// + " ";
if(!t.time_of_day().is_special()) {
@@ -163,20 +164,20 @@ namespace posix_time {
//! Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff]
/*!\ingroup time_format
*/
inline
std::string
to_simple_string(time_period tp)
inline
std::string
to_simple_string(time_period tp)
{
std::string d1(to_simple_string(tp.begin()));
std::string d2(to_simple_string(tp.last()));
return std::string("[" + d1 + "/" + d2 +"]");
}
//! Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator
//! Convert ISO 8601 short form YYYYMMDDTHHMMSS where T is the date-time separator
/*!\ingroup time_format
*/
inline
std::string to_iso_string(ptime t)
inline
std::string to_iso_string(ptime t)
{
std::string ts = gregorian::to_iso_string(t.date());// + "T";
if(!t.time_of_day().is_special()) {
@@ -190,9 +191,9 @@ namespace posix_time {
//! Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator
/*!\ingroup time_format
*/
inline
std::string
to_iso_extended_string(ptime t)
inline
std::string
to_iso_extended_string(ptime t)
{
std::string ts = gregorian::to_iso_extended_string(t.date());// + "T";
if(!t.time_of_day().is_special()) {
@@ -35,6 +35,14 @@ namespace posix_time {
return date_time::parse_iso_time<ptime>(s, 'T');
}
inline ptime from_iso_extended_string(const std::string& s) {
if (s.size() == 10) { //assume we just have a date which is 10 chars
gregorian::date d = gregorian::from_simple_string(s);
return ptime( d );
}
return date_time::parse_delimited_time<ptime>(s, 'T');
}
} } //namespace posix_time
@@ -11,19 +11,45 @@
#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/date_time/gregorian/greg_serialize.hpp"
#include "boost/serialization/split_free.hpp"
#include "boost/core/nvp.hpp"
#include "boost/numeric/conversion/cast.hpp"
#include "boost/type_traits/integral_constant.hpp"
// macros to split serialize functions into save & load functions
// NOTE: these macros define template functions in the boost::serialization namespace.
// They must be expanded *outside* of any namespace
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::ptime)
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_duration)
BOOST_SERIALIZATION_SPLIT_FREE(boost::posix_time::time_period)
// Define versions for serialization compatibility
// alows the unit tests to make an older version to check compatibility
#ifndef BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION
#define BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION 1
#endif
namespace boost {
namespace serialization {
template<typename T>
struct version;
template<>
struct version<boost::posix_time::time_duration>
: integral_constant<int, BOOST_DATE_TIME_POSIX_TIME_DURATION_VERSION>
{
};
// A macro to split serialize functions into save & load functions.
// It is here to avoid dependency on Boost.Serialization just for the
// BOOST_SERIALIZATION_SPLIT_FREE macro
#define BOOST_DATE_TIME_SPLIT_FREE(T) \
template<class Archive> \
inline void serialize(Archive & ar, \
T & t, \
const unsigned int file_version) \
{ \
split_free(ar, t, file_version); \
}
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::ptime)
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::time_duration)
BOOST_DATE_TIME_SPLIT_FREE(boost::posix_time::time_period)
#undef BOOST_DATE_TIME_SPLIT_FREE
/*** time_duration ***/
@@ -32,10 +58,23 @@ namespace serialization {
* types are hour_type, min_type, sec_type, and fractional_seconds_type
* as defined in the time_duration class
*/
template<class TimeResTraitsSize, class Archive>
void save_td(Archive& ar, const posix_time::time_duration& td)
{
TimeResTraitsSize h = boost::numeric_cast<TimeResTraitsSize>(td.hours());
TimeResTraitsSize m = boost::numeric_cast<TimeResTraitsSize>(td.minutes());
TimeResTraitsSize s = boost::numeric_cast<TimeResTraitsSize>(td.seconds());
posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
}
template<class Archive>
void save(Archive & ar,
const posix_time::time_duration& td,
unsigned int /*version*/)
unsigned int version)
{
// serialize a bool so we know how to read this back in later
bool is_special = td.is_special();
@@ -45,14 +84,13 @@ void save(Archive & ar,
ar & make_nvp("sv_time_duration", s);
}
else {
typename posix_time::time_duration::hour_type h = td.hours();
typename posix_time::time_duration::min_type m = td.minutes();
typename posix_time::time_duration::sec_type s = td.seconds();
typename posix_time::time_duration::fractional_seconds_type fs = td.fractional_seconds();
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
// Write support for earlier versions allows for upgrade compatibility testing
// See load comments for version information
if (version == 0) {
save_td<int32_t>(ar, td);
} else {
save_td<int64_t>(ar, td);
}
}
}
@@ -61,10 +99,24 @@ void save(Archive & ar,
* types are hour_type, min_type, sec_type, and fractional_seconds_type
* as defined in the time_duration class
*/
template<class TimeResTraitsSize, class Archive>
void load_td(Archive& ar, posix_time::time_duration& td)
{
TimeResTraitsSize h(0);
TimeResTraitsSize m(0);
TimeResTraitsSize s(0);
posix_time::time_duration::fractional_seconds_type fs(0);
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
td = posix_time::time_duration(h, m, s, fs);
}
template<class Archive>
void load(Archive & ar,
posix_time::time_duration & td,
unsigned int /*version*/)
unsigned int version)
{
bool is_special = false;
ar & make_nvp("is_special", is_special);
@@ -75,15 +127,25 @@ void load(Archive & ar,
td = posix_time::time_duration(sv);
}
else {
typename posix_time::time_duration::hour_type h(0);
typename posix_time::time_duration::min_type m(0);
typename posix_time::time_duration::sec_type s(0);
typename posix_time::time_duration::fractional_seconds_type fs(0);
ar & make_nvp("time_duration_hours", h);
ar & make_nvp("time_duration_minutes", m);
ar & make_nvp("time_duration_seconds", s);
ar & make_nvp("time_duration_fractional_seconds", fs);
td = posix_time::time_duration(h,m,s,fs);
// Version "0" (Boost 1.65.1 or earlier, which used int32_t for day/hour/minute/second and
// therefore suffered from the year 2038 issue.)
// Version "0.5" (Boost 1.66.0 changed to std::time_t but did not increase the version;
// it was missed in the original change, all code reviews, and there were no
// static assertions to protect the code; further std::time_t can be 32-bit
// or 64-bit so it reduced portability. This makes 1.66.0 hard to handle...)
// Version "1" (Boost 1.67.0 or later uses int64_t and is properly versioned)
// If the size of any of these items changes, a new version is needed.
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::hour_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::min_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::sec_type) == sizeof(boost::int64_t));
BOOST_STATIC_ASSERT(sizeof(posix_time::time_duration::fractional_seconds_type) == sizeof(boost::int64_t));
if (version == 0) {
load_td<int32_t>(ar, td);
} else {
load_td<int64_t>(ar, td);
}
}
}
@@ -103,10 +165,10 @@ void save(Archive & ar,
{
// from_iso_string does not include fractional seconds
// therefore date and time_duration are used
typename posix_time::ptime::date_type d = pt.date();
posix_time::ptime::date_type d = pt.date();
ar & make_nvp("ptime_date", d);
if(!pt.is_special()) {
typename posix_time::ptime::time_duration_type td = pt.time_of_day();
posix_time::ptime::time_duration_type td = pt.time_of_day();
ar & make_nvp("ptime_time_duration", td);
}
}
@@ -122,8 +184,8 @@ void load(Archive & ar,
{
// from_iso_string does not include fractional seconds
// therefore date and time_duration are used
typename posix_time::ptime::date_type d(posix_time::not_a_date_time);
typename posix_time::ptime::time_duration_type td;
posix_time::ptime::date_type d(posix_time::not_a_date_time);
posix_time::ptime::time_duration_type td;
ar & make_nvp("ptime_date", d);
if(!d.is_special()) {
ar & make_nvp("ptime_time_duration", td);
@@ -137,7 +199,7 @@ void load(Archive & ar,
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
posix_time::ptime* pt,
const unsigned int /*file_version*/)
{
@@ -183,7 +245,7 @@ void load(Archive & ar,
//!override needed b/c no default constructor
template<class Archive>
inline void load_construct_data(Archive & ar,
inline void load_construct_data(Archive & /*ar*/,
boost::posix_time::time_period* tp,
const unsigned int /*file_version*/)
{
@@ -12,6 +12,7 @@
#include <vector>
#include <string>
#include <iterator>
#include "boost/date_time/special_defs.hpp"
namespace boost { namespace date_time {
@@ -34,14 +34,9 @@ namespace boost { namespace date_time {
{
public:
typedef std::basic_string<charT> string_type;
//typedef std::basic_stringstream<charT> stringstream_type;
typedef std::basic_stringstream<charT> stringstream_type;
typedef std::istreambuf_iterator<charT> stream_itr_type;
//typedef typename string_type::const_iterator const_itr;
//typedef typename date_type::year_type year_type;
//typedef typename date_type::month_type month_type;
typedef typename date_type::duration_type duration_type;
//typedef typename date_type::day_of_week_type day_of_week_type;
//typedef typename date_type::day_type day_type;
typedef string_parse_tree<charT> parse_tree_type;
typedef typename parse_tree_type::parse_match_result_type match_results;
typedef std::vector<std::basic_string<charT> > collection_type;
@@ -80,11 +75,6 @@ namespace boost { namespace date_time {
m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time));
}
special_values_parser(const special_values_parser<date_type,charT>& svp)
{
this->m_sv_strings = svp.m_sv_strings;
}
//! Replace special value strings
void sv_strings(const string_type& nadt_str,
const string_type& neg_inf_str,
@@ -101,11 +91,37 @@ namespace boost { namespace date_time {
m_sv_strings = parse_tree_type(phrases, static_cast<int>(not_a_date_time));
}
/* Does not return a special_value because if the parsing fails,
* the return value will always be not_a_date_time
* (mr.current_match retains its default value of -1 on a failed
* parse and that casts to not_a_date_time). */
//! Sets match_results.current_match to the corresponding special_value or -1
//! The parser is expensive to create, and not thread-safe so it cannot be static
//! therefore given a string, determine if it is likely to be a special value.
//! A negative response is a definite no, whereas a positive is only likely and
//! match() should be called and return value checked.
//! \param[in] str the string to check
//! \returns false if it is definitely not a special value
static bool should_call_match(const string_type& str)
{
if (!str.empty()) {
switch (str[0]) {
// See string definitions at the end of this class..
case '+':
case '-':
case 'n':
case 'm':
return true;
default:
break;
}
}
return false;
}
//! Given an input iterator, attempt to match it to a known special value
//! \param[in] sitr the start iterator
//! \param[in] str_end the end iterator
//! \param[out] mr the match result:
//! mr.current_match is set to the corresponding special_value or -1
//! \returns whether something matched
bool match(stream_itr_type& sitr,
stream_itr_type& str_end,
match_results& mr) const
@@ -114,18 +130,6 @@ namespace boost { namespace date_time {
m_sv_strings.match(sitr, str_end, mr, level);
return (mr.current_match != match_results::PARSE_ERROR);
}
/*special_values match(stream_itr_type& sitr,
stream_itr_type& str_end,
match_results& mr) const
{
unsigned int level = 0;
m_sv_strings.match(sitr, str_end, mr, level);
if(mr.current_match == match_results::PARSE_ERROR) {
throw std::ios_base::failure("Parse failed. No match found for '" + mr.cache + "'");
}
return static_cast<special_values>(mr.current_match);
}*/
private:
parse_tree_type m_sv_strings;
@@ -21,7 +21,6 @@ namespace date_time {
inline
std::basic_string<OutputT> convert_string_type(const std::basic_string<InputT>& inp_str)
{
typedef std::basic_string<InputT> input_type;
typedef std::basic_string<OutputT> output_type;
output_type result;
result.insert(result.begin(), inp_str.begin(), inp_str.end());

Some files were not shown because too many files have changed in this diff Show More