Commit Graph

599 Commits

Author SHA1 Message Date
Raphaël Duhen
f972dc9656 Fix minor typo (#210)
Thanks!
2022-04-29 09:33:12 -07:00
Owen Rudge
64fe6586fe Fix from_time_t Y2K38 bug on LLP64 platforms 2022-03-01 11:15:22 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
3f092da750 trac-13159, trac-12630: fix maximum year to 9999 2018-01-24 09:44:04 -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
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
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
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
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
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
James E. King, III
b3b6ddd5ba trac-13194: fix time input facet processing for %e 2017-12-22 08:02:24 -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
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