Commit Graph

16618 Commits

Author SHA1 Message Date
John Ralls
269bb510fb Implement GncDate::format()
Analog of GncDateTime::format().
2015-05-04 15:05:52 -07:00
John Ralls
2b84dfae8d Remove some noisy comments.
That duplicate the Doxygen comments in the header.
2015-05-04 15:05:52 -07:00
John Ralls
e1e4391b03 Remove unused gnc_timezone function. 2015-05-04 15:05:52 -07:00
John Ralls
f4451ff57d Remove gnc_gdate_range_check.
Since GncDate and GncDateTime will have the same limits it's not
necessary.
2015-05-04 15:05:52 -07:00
Benjamin Melançon
7c42908b13 Update README to refer to Git rather than SVN 2015-05-03 16:13:20 -07:00
John Ralls
9ea1dd0fac Merge branch 'boost-date'
First merge, which replaces GDateTime with GncDateTime. GncDateTime is
implemented as a PImpl to a wrapper class for boost::date_time. A skeleton
implementation of GncDate is included. More work on that will go into the
next merge.
2015-05-02 17:40:33 -07:00
John Ralls
280589a33e Adjust some tests for 64-bit.
The libc time functions are apparently not too smart about applying
timezones to date-times, using the current TZ info rather than the
one that applies to the date.

Formatting is a bit variable as well when localization is applied,
so test with the locale format when appropriate.
2015-05-02 17:39:05 -07:00
John Ralls
25be764cb0 Replace boost::posix_date::from_time_t().
It silently converts a 64-bit time_t to 32-bits.
2015-05-02 17:39:05 -07:00
John Ralls
b215d62925 Replace 'using make_week_num' with a macro; gcc-4.8 can't do that kind of alias. 2015-04-30 16:09:40 -07:00
John Ralls
9fafb61283 Restore #include strptime.h, needed on MinGW. 2015-04-30 16:08:24 -07:00
John Ralls
48a5473bbb Add BOOST_LDFLAGS so that libboost_date_time can be found in MinGW. 2015-04-30 16:06:28 -07:00
John Ralls
9fbc447f74 Some gcc don't like having a struct ymd and a ymd() member function. 2015-04-30 12:23:25 -07:00
John Ralls
f87f9ca02d gnc_date_today from GncDate. 2015-04-28 17:54:05 -07:00
John Ralls
bcedeff3ba Fix the string constructor to apply the timezone correctly. 2015-04-28 17:53:35 -07:00
John Ralls
ac515d6ce2 Stop testing fractional seconds.
We don't use them in real code, so the new implementation isn't going to
support them.
2015-04-28 17:52:56 -07:00
John Ralls
a8028ec7f2 Remove aliases and boost::date_time construction functions from gnc-date. 2015-04-28 17:05:35 -07:00
John Ralls
f46e9f023c Print functions to GncDateTime. 2015-04-28 17:04:09 -07:00
John Ralls
db6b7d368e gnc_time to GncDateTime. 2015-04-28 17:03:20 -07:00
John Ralls
671a6ac75e Remove extraneous try block. 2015-04-28 16:44:59 -07:00
John Ralls
d2f80a9407 gnc_mktime and gnc_timegm with GncDateTime. 2015-04-28 16:28:51 -07:00
John Ralls
2dde36d015 Do locality and gmtime with GncDateTime. 2015-04-28 15:22:15 -07:00
John Ralls
d4a3d862cf Include gnc-datetime.hpp in gnc-date.cpp. 2015-04-28 14:19:00 -07:00
John Ralls
78b974ad79 Add gnc-datetime.cpp to the build. 2015-04-28 14:08:02 -07:00
John Ralls
ab72874ec1 Add GncDate and GncDateTime constructors and accessors:
GncDateImpl constructor and ymd accessor for GncDate
Std::string constructor and nsecs and GDate accessors for GncDateTime.
2015-04-28 13:40:48 -07:00
John Ralls
3f87f56e2e Implement formatted output. 2015-04-28 10:48:56 -07:00
John Ralls
cbb01c94ae Implement struct tm constructor and cast, offset accessor. 2015-04-28 10:48:56 -07:00
John Ralls
e5861dc119 Add operator time64() to enable static_casting a GncDateTime. 2015-04-28 10:48:56 -07:00
John Ralls
10daa27abc Default constructors return the epoch.
GncDate::today() and GncDateTime::now() get the current date and time.

Suggested in a C++Now talk by Jeff Garland, the author of boost::date_time.
Reasoning is that getting time from the system clock is expensive and so
shouldn't be done unless needed.
2015-04-28 10:48:56 -07:00
John Ralls
01f5a9c04c Update filename, copyright in comments for gnu-date.c 2015-04-28 10:48:56 -07:00
John Ralls
307c08e2b5 Begin GncDate and GncDateTime classes.
Goal is to get the boost::date_time code out of gnu-date.c, to provide
date-time functionality directly to C++, and to replace GDate.
2015-04-28 10:48:56 -07:00
John Ralls
09356976cc Fix test-aqb timestamp so that it's 29 August in most timezones. 2015-04-28 10:48:55 -07:00
John Ralls
d0ae8c370e Fix stray if and tab-indentation. 2015-04-28 10:48:55 -07:00
John Ralls
d0b916c6f9 Fix offset calculations for TZif2 files. 2015-04-28 10:48:55 -07:00
John Ralls
5a378e1e91 Fix GCC type-deduction failure. 2015-04-28 10:48:55 -07:00
John Ralls
197d43f4a1 Rewrite test-gnc-date.c to not use GDateTime for reference. 2015-04-28 10:48:55 -07:00
John Ralls
327ef838ea Correct a couple of incorrect comments. 2015-04-28 10:48:55 -07:00
John Ralls
e938b39ff2 Remove gnc_time_utc.
It produces exactly the same result as gnc_time: The current utc time.
2015-04-28 10:48:55 -07:00
John Ralls
4f90e4e050 Get rid of gettimeofday call in Transaction.
We were throwing away the microseconds anyway.
2015-04-28 10:48:55 -07:00
John Ralls
99efb5d446 Reimplement gnc_timespec_to_iso8601_buff to handle microseconds.
Just because there are tests that do. Removing fractional seconds (which
are never used in live code) will be  a separate step.
2015-04-28 10:48:55 -07:00
John Ralls
23687ee21c Replace random uses of GDateTime. 2015-04-28 10:48:55 -07:00
John Ralls
eb3bafed7f Ensure HH:MM:SS field separators are in place for timezone offsets 2015-04-28 10:48:55 -07:00
John Ralls
ae11e3506f Boost::date_time uses "%q" to format timezones by offset. 2015-04-28 10:48:54 -07:00
John Ralls
154911e23f Align GDate's month (1-12) with struct tm's (0-11).
Wow. This has gone undetected for an amazingly long time.
2015-04-28 10:48:54 -07:00
John Ralls
32852ec49b Ensure that gnc_timespec_to_iso8601_buff's buff is initialized empty.
So that there's no trailing garbage on the string.
2015-04-28 10:48:54 -07:00
John Ralls
83f2627bbb Implement gnc_timegm correctly. 2015-04-28 10:48:54 -07:00
John Ralls
6fd68c3caa Fix missed change from PLATFORM_OSX to GNC_PLATFORM_OSX. 2015-04-28 10:48:54 -07:00
John Ralls
9f2d3843f8 Miscellaneous corrections to pass tests.
Includes removing some tests that are either no longer relevant or which
only tested test conditions.
2015-04-28 10:48:54 -07:00
John Ralls
fb6992f303 Separate the initial case so that it ends the year before the first transition.
This permits the zone_vector to actually get the first transition.
2015-04-28 10:48:54 -07:00
John Ralls
23d4e4a56f Correct week determination when computing DST transitions from timestamps. 2015-04-28 10:48:54 -07:00
John Ralls
c7ca7850df Correct gncBillTerm's use of gnc_date_get_last_mday() to use the struct_tm form of month.
I.e., where January is 0.
2015-04-28 10:48:54 -07:00