Commit Graph

35 Commits

Author SHA1 Message Date
Moritz Klammler
79c125b54f Initialize data members for defaulted c'tors
This patch addresses a static analysis issue reported by Cppcheck 2.9
where several classes in the toml/datetime.hpp header explicitly default
all their special member functions, including the default constructor,
but don't provide initializers for their data members.  This might or
might not have caused any observable surprising behavior but I agree
with Cppcheck on this one in that an explicitly defaulted default
constructor should be expected to initialize all data members.  So let's
do that.
2022-09-29 17:59:27 +02:00
ToruNiina
97cc0ef62b fix #166: reorder local/gmtime wrapper for MSVC 2022-03-13 00:20:00 +09:00
ToruNiina
b1c9df8998 feat: reorder headers following google c++ style
related to: #115
2020-06-28 00:58:20 +09:00
Jordan Williams
6b5944e839 fix -Wundef warnings 2020-02-11 06:30:18 -06:00
ToruNiina
9f92916d1d fix: suppress -Wuseless-conversion
`{integer} + 1` will automatically be an int, so static_cast<int>(a+1)
will be useless conversion.
2020-01-13 11:24:48 +09:00
ToruNiina
331de4ea5d fix: use datetime info while getting time offset
to convert offset_datetime to system_clock::time_point.
2019-12-08 22:44:12 +11:00
ToruNiina
b246f5ac5c fix: combine date and time to convert loc datetime
Normally DST begins at A.M. 3 or 4. If we re-use conversion operator
of local_date and local_time independently, the conversion fails if
it is the day when DST begins or ends. Since local_date considers the
time is 00:00 A.M. and local_time does not consider DST because it
does not have any date information. We need to consider both date and
time information at the same time to convert it correctly.
2019-12-08 22:38:49 +11:00
ToruNiina
62c01f9826 fix: consider timezone correctly
explicitly set tm.tm_isdst = 0 and use UTC offset
2019-12-06 20:57:51 +09:00
ToruNiina
5a8d368927 feat: add thread-safe detail::gmtime_s 2019-12-06 20:33:15 +09:00
blockparty
7e62dad6dc Check if features are defined 2019-11-21 05:51:31 -06:00
ToruNiina
ecf55f86d6 refactor: add explicit type conversion 2019-06-21 00:25:57 +09:00
ToruNiina
71ff54e76c fix: rearrange internal int types in datetimes 2019-06-20 23:58:08 +09:00
Ivan Shynkarenka
db6f3d5d11 Fix Visual Studio 2019 warnings in pedantic compilation mode (/W4 /WX) 2019-05-10 14:58:22 +03:00
Petr Benes
ba307003c4 fix /W4 warnings on MSVC 2019-04-16 13:25:45 +02:00
ToruNiina
243f43fafd Merge branch 'master' into hotfix 2019-03-17 21:16:37 +09:00
ToruNiina
66e27a94b6 fix: simplify and correct the format of timezone 2019-03-17 21:14:17 +09:00
ToruNiina
fd063af7ce refactor: make include guard style uniform 2019-03-16 14:19:47 +09:00
ToruNiina
51dd3abcae remove one branch by preprocessor
since localtime in windows is already thread-safe, there are no need to
change the function.
2018-12-26 13:38:01 +09:00
ToruNiina
825b2c30a1 add threadsafe localtime_(s|r) 2018-12-25 22:40:52 +09:00
ToruNiina
fd21d5dd95 add simplest copyright notice 2018-12-13 20:44:10 +09:00
ToruNiina
5125287ac7 fix datetime conversion
use internal duration type in std::chrono::system_clock::time_point
2018-12-13 14:57:42 +09:00
ToruNiina
26e0d87d3b enable nanoseconds in datetimes 2018-12-13 12:49:53 +09:00
ToruNiina
03be08a2e6 fix conversion from offset_datetime to system_clock::time_point 2018-12-12 20:28:11 +09:00
ToruNiina
dc8ccdc458 construct much more tmp variables
std::chrono::seconds -= std::chrono::milliseconds cannot be done bc
it represents the duration as integer value and milliseconds are less
than seconds. it causes compilation error when we pass a duration to
toml::local_time. to avoid this, we need to type-cast the values to
smaller duration, like sec -> msec
2018-12-09 18:00:46 +09:00
ToruNiina
9fadf71a10 add constructor from duration to local_time 2018-12-09 16:27:47 +09:00
ToruNiina
b0e7efa1e0 make some constructors explicit 2018-12-09 13:38:57 +09:00
ToruNiina
a1aa780a60 Merge branch 'toml-v050' of github.com 2018-12-09 11:05:26 +09:00
ToruNiina
48f3b73b91 add ctor(local_datetime, time_offset) to offset_datetime 2018-12-09 00:11:07 +09:00
ToruNiina
bb215836dc add missing header files 2018-12-08 20:39:37 +09:00
ToruNiina
3ef33c1637 change almost everything about datetime 2018-12-08 19:04:41 +09:00
ToruNiina
c706a54121 add namespace specifier 2017-05-09 22:07:28 +09:00
ToruNiina
a1218b266a add restriction to datetime offset size 2017-05-07 13:50:53 +09:00
ToruNiina
bbb9388d3a add typedefs to basic_datetiem 2017-05-06 18:43:55 +09:00
ToruNiina
833c69628a fix datetime::ctor and stream operator for datetime 2017-04-21 15:54:48 +09:00
ToruNiina
337a671f0c split datetime definition from toml.hpp 2017-04-21 12:56:39 +09:00