r20293 - gnucash/trunk/src/libqof/qof - Add a Timespec constructor for the current clock time.
Christian Stimming
cstim at code.gnucash.org
Sat Feb 12 16:55:46 EST 2011
Author: cstim
Date: 2011-02-12 16:55:46 -0500 (Sat, 12 Feb 2011)
New Revision: 20293
Trac: http://svn.gnucash.org/trac/changeset/20293
Modified:
gnucash/trunk/src/libqof/qof/gnc-date.c
gnucash/trunk/src/libqof/qof/gnc-date.h
Log:
Add a Timespec constructor for the current clock time.
Modified: gnucash/trunk/src/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.c 2011-02-12 20:32:17 UTC (rev 20292)
+++ gnucash/trunk/src/libqof/qof/gnc-date.c 2011-02-12 21:55:46 UTC (rev 20293)
@@ -1535,6 +1535,15 @@
ts->tv_nsec = 0;
}
+Timespec
+timespec_now()
+{
+ Timespec ts;
+ ts.tv_sec = time(NULL);
+ ts.tv_nsec = 0;
+ return ts;
+}
+
time_t
timespecToTime_t (Timespec ts)
{
Modified: gnucash/trunk/src/libqof/qof/gnc-date.h
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.h 2011-02-12 20:32:17 UTC (rev 20292)
+++ gnucash/trunk/src/libqof/qof/gnc-date.h 2011-02-12 21:55:46 UTC (rev 20293)
@@ -212,6 +212,9 @@
* the timepair representing midday on that day */
Timespec timespecCanonicalDayTime(Timespec t);
+/** Returns the current clock time as a Timespec, taken from time(2). */
+Timespec timespec_now (void);
+
/** Turns a time_t into a Timespec */
void timespecFromTime_t( Timespec *ts, time_t t );
More information about the gnucash-changes
mailing list