diff --git a/src/engine/test-core/test-engine-stuff.c b/src/engine/test-core/test-engine-stuff.c index 2073afe9f7..857e9b2f83 100644 --- a/src/engine/test-core/test-engine-stuff.c +++ b/src/engine/test-core/test-engine-stuff.c @@ -224,20 +224,7 @@ get_random_timespec(void) while (ret->tv_sec <= 0) ret->tv_sec = rand(); - if (zero_nsec) - ret->tv_nsec = 0; - else - { - ret->tv_nsec = rand(); - - if (usec_resolution) - { - ret->tv_nsec = MIN (ret->tv_nsec, 999999999); - ret->tv_nsec /= 1000; - ret->tv_nsec *= 1000; - } - } - + ret->tv_nsec = 0; return ret; } diff --git a/src/engine/test/test-date.c b/src/engine/test/test-date.c index 93974861eb..492975a750 100644 --- a/src/engine/test/test-date.c +++ b/src/engine/test/test-date.c @@ -325,7 +325,7 @@ run_test (void) check_time (ts, do_print); ts.tv_sec = 1162088421; - ts.tv_nsec = 12548000; + ts.tv_nsec = 0; check_time (ts, do_print); ts.tv_sec = 325659000 - 6500; @@ -337,15 +337,15 @@ run_test (void) check_time (ts, do_print); ts.tv_sec = 1603591171; - ts.tv_nsec = 595311000; + ts.tv_nsec = 0; check_time (ts, do_print); ts.tv_sec = 1738909365; - ts.tv_nsec = 204102000; + ts.tv_nsec = 0; check_time (ts, do_print); ts.tv_sec = 1603591171; - ts.tv_nsec = 595311000; + ts.tv_nsec = 0; check_time (ts, do_print); ts.tv_sec = 1143943200 - 1; diff --git a/src/libqof/qof/gnc-date.cpp b/src/libqof/qof/gnc-date.cpp index 0375b2ad6c..e0a689d59a 100644 --- a/src/libqof/qof/gnc-date.cpp +++ b/src/libqof/qof/gnc-date.cpp @@ -1246,12 +1246,11 @@ Timespec gnc_iso8601_to_timespec_gmt(const char *cstr) { time64 time; - uint32_t nsecs; if (!cstr) return {0, 0}; try { GncDateTime gncdt(cstr); - return {static_cast(gncdt), gncdt.nsecs()}; + return {static_cast(gncdt), 0}; } catch(...) { diff --git a/src/libqof/qof/gnc-datetime.cpp b/src/libqof/qof/gnc-datetime.cpp index 40ac1a689b..20c78c4c46 100644 --- a/src/libqof/qof/gnc-datetime.cpp +++ b/src/libqof/qof/gnc-datetime.cpp @@ -126,7 +126,6 @@ public: operator struct tm() const; void now() { m_time = boost::local_time::local_sec_clock::local_time(tzp.get(boost::gregorian::day_clock::local_day().year())); } long offset() const; - long nsecs() const; struct tm utc_tm() const { return to_tm(m_time.utc_time()); } std::unique_ptr date() const; std::string format(const char* format) const; @@ -186,12 +185,6 @@ GncDateTimeImpl::offset() const return offset.total_seconds(); } -long -GncDateTimeImpl::nsecs() const -{ - return (m_time.utc_time() - unix_epoch).ticks() % ticks_per_second; -} - std::unique_ptr GncDateTimeImpl::date() const { @@ -265,12 +258,6 @@ GncDateTime::offset() const return m_impl->offset(); } -long -GncDateTime::nsecs() const -{ - return m_impl->nsecs(); -} - struct tm GncDateTime::utc_tm() const { diff --git a/src/libqof/qof/gnc-datetime.hpp b/src/libqof/qof/gnc-datetime.hpp index 46dd83d896..31278045f0 100644 --- a/src/libqof/qof/gnc-datetime.hpp +++ b/src/libqof/qof/gnc-datetime.hpp @@ -131,11 +131,6 @@ public: * is negative. */ long offset()const; -/** Obtain the fractional seconds from the GncDateTime - * @return Fractional seconds, represented as nanoseconds, associated - * with the time. - */ - long nsecs() const; /** Obtain a struct tm representing the time in UTC. * @return struct tm */ diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/libqof/qof/test/test-gnc-date.c index 93f9943e32..396deb9db9 100644 --- a/src/libqof/qof/test/test-gnc-date.c +++ b/src/libqof/qof/test/test-gnc-date.c @@ -93,7 +93,7 @@ static void setup (FixtureA *f, gconstpointer pData) f->off_zulu = (TZOffset){0, 0}; f->off_05w = (TZOffset){-5, 0}; f->off_0840e = (TZOffset){8, 40}; - f->ts1 = (Timespec){607009407, 345678000}; //1989-3-27 13:43:27.345678 Z + f->ts1 = (Timespec){607009407, 0}; //1989-3-27 13:43:27 Z f->ts2 = (Timespec){1604748079, 0}; //2020-11-7 06:21:19 -05:00 f->ts3 = (Timespec){1341398864, 0}; //2012-07-04 19:27:44 +08:40 f->ts4 = (Timespec){-261104801, 0}; //1961-09-22 17:53:19 -05:00 @@ -1590,7 +1590,7 @@ test_gnc_iso8601_to_timespec_gmt (FixtureA *f, gconstpointer pData) g_assert_cmpint (t.tv_sec, ==, 0); g_assert_cmpint (t.tv_nsec, ==, 0); - t = gnc_iso8601_to_timespec_gmt ("1989-03-27 13:43:27.345678"); + t = gnc_iso8601_to_timespec_gmt ("1989-03-27 13:43:27"); g_assert_cmpint (t.tv_sec, ==, f->ts1.tv_sec); /* MinGW has some precision issues in the last microsecond digit */ #ifdef G_OS_WIN32