GnuCash  2.6.16
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Date: Date and Time Printing, Parsing and Manipulation

Files

file  gnc-date.h
 Date and Time handling routines.
 

Data Structures

struct  Timespec
 Use a 64-bit unsigned int timespec. More...
 

Macros

#define MAX_DATE_LENGTH   34
 
#define QOF_UTC_DATE_FORMAT   "%Y-%m-%dT%H:%M:%SZ"
 UTC date format string. More...
 
#define DATE_FORMAT_FIRST   QOF_DATE_FORMAT_US
 
#define DATE_FORMAT_LAST   QOF_DATE_FORMAT_UTC
 
#define qof_date_format_get_format   qof_date_text_format_get_string
 

Typedefs

typedef gint64 time64
 

Enumerations

enum  QofDateFormat {
  QOF_DATE_FORMAT_US, QOF_DATE_FORMAT_UK, QOF_DATE_FORMAT_CE, QOF_DATE_FORMAT_ISO,
  QOF_DATE_FORMAT_LOCALE, QOF_DATE_FORMAT_UTC, QOF_DATE_FORMAT_CUSTOM, QOF_DATE_FORMAT_UNSET
}
 
enum  QofDateCompletion { QOF_DATE_COMPLETION_THISYEAR, QOF_DATE_COMPLETION_SLIDING }
 
enum  GNCDateMonthFormat { GNCDATE_MONTH_NUMBER, GNCDATE_MONTH_ABBREV, GNCDATE_MONTH_NAME }
 

Functions

struct tm * gnc_localtime (const time64 *secs)
 fill out a time struct from a 64-bit time value. More...
 
struct tm * gnc_localtime_r (const time64 *secs, struct tm *time)
 fill out a time struct from a 64-bit time value adjusted for the current time zone. More...
 
struct tm * gnc_gmtime (const time64 *secs)
 fill out a time struct from a 64-bit time value More...
 
time64 gnc_mktime (struct tm *time)
 calculate seconds from the epoch given a time struct More...
 
time64 gnc_timegm (struct tm *time)
 calculate seconds from the epoch given a time struct More...
 
gchar * gnc_ctime (const time64 *secs)
 Return a string representation of a date from a 64-bit time value. More...
 
time64 gnc_time (time64 *tbuf)
 get the current local time More...
 
time64 gnc_time_utc (time64 *tbuf)
 get the current UTC time More...
 
gdouble gnc_difftime (const time64 secs1, const time64 secs2)
 Find the difference in seconds between two time values. More...
 
GDateTime * gnc_g_date_time_new_from_unix_local (time64 time)
 
void gnc_tm_free (struct tm *time)
 free a struct tm* created with gnc_localtime() or gnc_gmtime() More...
 
GDateTime * gnc_g_date_time_new_from_timespec_local (Timespec tm)
 Create a GDateTime from a Timespec. More...
 
void qof_date_completion_set (QofDateCompletion dc, int backmonths)
 
gchar dateSeparator (void)
 

Variables

const char * gnc_default_strftime_date_format
 

GValue

GType timespec_get_type (void)
 
#define GNC_TYPE_TIMESPEC   (timespec_get_type ())
 

String / DateFormat conversion.

const gchar * gnc_date_dateformat_to_string (QofDateFormat format)
 The string->value versions return FALSE on success and TRUE on failure.
 
gboolean gnc_date_string_to_dateformat (const gchar *format_string, QofDateFormat *format)
 Converts the date format to a printable string. More...
 
const gchar * gnc_date_monthformat_to_string (GNCDateMonthFormat format)
 
gboolean gnc_date_string_to_monthformat (const gchar *format_string, GNCDateMonthFormat *format)
 Converts the month format to a printable string. More...
 

Timespec functions

gboolean timespec_equal (const Timespec *ta, const Timespec *tb)
 
gint timespec_cmp (const Timespec *ta, const Timespec *tb)
 
Timespec timespec_diff (const Timespec *ta, const Timespec *tb)
 
Timespec timespec_abs (const Timespec *t)
 
Timespec timespecCanonicalDayTime (Timespec t)
 
Timespec timespec_now (void)
 
void timespecFromTime64 (Timespec *ts, time64 t)
 
time64 timespecToTime64 (Timespec ts)
 
GDate * gnc_g_date_new_today (void)
 
GDate timespec_to_gdate (Timespec ts)
 
Timespec gdate_to_timespec (GDate d)
 
Timespec gnc_dmy2timespec (gint day, gint month, gint year)
 
Timespec gnc_dmy2timespec_end (gint day, gint month, gint year)
 
Timespec gnc_dmy2timespec_neutral (gint day, gint month, gint year)
 
Timespec gnc_iso8601_to_timespec_gmt (const gchar *)
 
gchar * gnc_timespec_to_iso8601_buff (Timespec ts, gchar *buff)
 
void gnc_timespec2dmy (Timespec ts, gint *day, gint *month, gint *year)
 
glong gnc_timezone (const struct tm *tm)
 

QofDateFormat functions

QofDateFormat qof_date_format_get (void)
 
void qof_date_format_set (QofDateFormat df)
 
const gchar * qof_date_format_get_string (QofDateFormat df)
 
const gchar * qof_date_text_format_get_string (QofDateFormat df)
 

Date Printing/Scanning functions

gsize qof_strftime (gchar *buf, gsize max, const gchar *format, const struct tm *tm)
 
size_t qof_print_date_dmy_buff (gchar *buff, size_t buflen, int day, int month, int year)
 
size_t qof_print_date_buff (char *buff, size_t buflen, time64 secs)
 
size_t qof_print_gdate (char *buf, size_t bufflen, const GDate *gd)
 
char * qof_print_date (time64 secs)
 
const char * gnc_print_date (Timespec ts)
 
size_t qof_print_date_time_buff (char *buff, size_t len, time64 secs)
 
gboolean qof_scan_date (const char *buff, int *day, int *month, int *year)
 

Date Start/End Adjustment routines

Given a time value, adjust it to be the beginning or end of that day.

time64 gnc_time64_get_day_start (time64 time_val)
 
time64 gnc_time64_get_day_end (time64 time_val)
 
int gnc_date_get_last_mday (int month, int year)
 

Today's Date

void gnc_tm_get_today_start (struct tm *tm)
 
void gnc_tm_get_today_end (struct tm *tm)
 
time64 gnc_time64_get_today_start (void)
 
time64 gnc_time64_get_today_end (void)
 
char * gnc_date_timestamp (void)
 Make a timestamp in YYYYMMDDHHMMSS format. More...
 
void gnc_dow_abbrev (gchar *buf, int buf_len, int dow)
 
#define MIN_BUF_LEN   10
 

Detailed Description

Utility functions to handle date and time (adjusting, getting the current date, printing the date and time, etc.)

Overall, this file is quite a mess. Note, however, that other applications, besides just GnuCash, use this file. In particular, GnoTime (gttr.sourcefore.net) uses this file, and this file is formally a part of QOF (qof.sourceforge.net).

An important note about time-keeping: The general goal of any program that works with numeric time values SHOULD BE to always stores and use UNIVERSAL TIME internally. Universal time is the 'one true time' that is independent of one's location on planet Earth. It is measured in seconds from midnight January 1, 1970 in localtime-Greenwich (GMT). If one wants to display the local time, then the display-print routine should make all final tweaks to print the local time. The local time must not be kept as a numeric value anywhere in the program. If one wants to parse a user's input string as if it were local time, then the output of the parse routine MUST BE universal time. A sane program must never ever store (to file or db) a time that is not Universal Time. Break these rules, and you will rue the day...

Warning
HACK ALERT – the scan and print routines should probably be moved to somewhere else. The engine really isn't involved with things like printing formats. This is needed mostly by the GUI and so on. If a file-io backend needs date handling, it should do it itself, instead of depending on the routines here.
(to be renamed qofdate.h in libqof2.)
Author
Copyright (C) 1997 Robin D. Clark rclar.nosp@m.k@cs.nosp@m..hmc..nosp@m.edu
Copyright (C) 1998-2001,2003 Linas Vepstas linas.nosp@m.@lin.nosp@m.as.or.nosp@m.g

Macro Definition Documentation

◆ MAX_DATE_LENGTH

#define MAX_DATE_LENGTH   34

The maximum length of a string created by the date printers

Definition at line 102 of file gnc-date.h.

◆ qof_date_format_get_format

#define qof_date_format_get_format   qof_date_text_format_get_string
Deprecated:
qof_date_format_get_format has been replaced by qof_date_text_format_get_string

Definition at line 141 of file gnc-date.h.

◆ QOF_UTC_DATE_FORMAT

#define QOF_UTC_DATE_FORMAT   "%Y-%m-%dT%H:%M:%SZ"

UTC date format string.

ConstantsTime zone independent, date and time inclusive, as used in the QSF backend. The T and Z characters are from xsd:dateTime format in coordinated universal time, UTC. You can reproduce the string from the GNU/Linux command line using the date utility: date -u +Y-m-dTH:M:SZ = 2004-12-12T23:39:11Z The datestring must be time zone independent and include all specified fields. Remember to use gmtime() NOT localtime()!

Definition at line 114 of file gnc-date.h.

Typedef Documentation

◆ time64

typedef gint64 time64

Many systems, including Microsoft Windows and BSD-derived Unixes like Darwin, are retaining the int-32 typedef for time_t. Since this stops working in 2038, we define our own:

Definition at line 79 of file gnc-date.h.

Enumeration Type Documentation

◆ GNCDateMonthFormat

This is how to format the month, as a number, an abbreviated string, or the full name.

Definition at line 147 of file gnc-date.h.

148 {
149  GNCDATE_MONTH_NUMBER,
150  GNCDATE_MONTH_ABBREV,
151  GNCDATE_MONTH_NAME
GNCDateMonthFormat
Definition: gnc-date.h:147

◆ QofDateCompletion

Enum for date completion modes (for dates entered without year)

Enumerator
QOF_DATE_COMPLETION_THISYEAR 

use current year

QOF_DATE_COMPLETION_SLIDING 

use sliding 12-month window

Definition at line 133 of file gnc-date.h.

◆ QofDateFormat

Enum for determining a date format

Enumerator
QOF_DATE_FORMAT_US 

United states: mm/dd/yyyy

QOF_DATE_FORMAT_UK 

Britain: dd/mm/yyyy

QOF_DATE_FORMAT_CE 

Continental Europe: dd.mm.yyyy

QOF_DATE_FORMAT_ISO 

ISO: yyyy-mm-dd

QOF_DATE_FORMAT_LOCALE 

Take from locale information

QOF_DATE_FORMAT_UTC 

UTC: 2004-12-12T23:39:11Z

QOF_DATE_FORMAT_CUSTOM 

Used by the check printing code

QOF_DATE_FORMAT_UNSET 

No Fancy Date Format, use Global

Definition at line 117 of file gnc-date.h.

Function Documentation

◆ dateSeparator()

gchar dateSeparator ( void  )

dateSeparator Return the field separator for the current date format

Args: none

Return: date character

Globals: global dateFormat value

Definition at line 1240 of file gnc-date.c.

1241 {
1242  static char locale_separator = '\0';
1243 
1244  switch (dateFormat)
1245  {
1246  case QOF_DATE_FORMAT_CE:
1247  return '.';
1248  case QOF_DATE_FORMAT_ISO:
1249  case QOF_DATE_FORMAT_UTC:
1250  return '-';
1251  case QOF_DATE_FORMAT_US:
1252  case QOF_DATE_FORMAT_UK:
1253  default:
1254  return '/';
1256  if (locale_separator != '\0')
1257  return locale_separator;
1258  else
1259  {
1260  /* Make a guess */
1261  gchar string[256];
1262  struct tm tm;
1263  time64 secs;
1264  gchar *s;
1265 
1266  secs = gnc_time (NULL);
1267  gnc_localtime_r(&secs, &tm);
1268  qof_strftime(string, sizeof(string), GNC_D_FMT, &tm);
1269 
1270  for (s = string; *s != '\0'; s++)
1271  if (!isdigit(*s))
1272  return (locale_separator = *s);
1273  }
1274  break;
1275  }
1276 
1277  return '\0';
1278 }
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition: gnc-date.c:249
gsize qof_strftime(gchar *buf, gsize max, const gchar *format, const struct tm *tm)
Definition: gnc-date.c:1369
time64 gnc_time(time64 *tbuf)
get the current local time
Definition: gnc-date.c:399
gint64 time64
Definition: gnc-date.h:79

◆ gdate_to_timespec()

Timespec gdate_to_timespec ( GDate  d)

Turns a GDate into a Timespec, returning the first second of the day

Definition at line 1688 of file gnc-date.c.

1689 {
1690  gnc_gdate_range_check (&d);
1691  return gnc_dmy2timespec_neutral (g_date_get_day(&d),
1692  g_date_get_month(&d),
1693  g_date_get_year(&d));
1694 }
Timespec gnc_dmy2timespec_neutral(gint day, gint month, gint year)

◆ gnc_ctime()

gchar* gnc_ctime ( const time64 secs)

Return a string representation of a date from a 64-bit time value.

Parameters
secsSeconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)
Returns
A string, which must be freed with g_free(), representing the date in the following format: Thu Nov 24 18:22:48 1986
\0 This is equivalent to the strftime format a b H:M:S Y.

Definition at line 390 of file gnc-date.c.

391 {
392  GDateTime *gdt = gnc_g_date_time_new_from_unix_local (*secs);
393  gchar *string = g_date_time_format (gdt, "%a %b %e %H:%M:%S %Y");
394  g_date_time_unref (gdt);
395  return string;
396 }
GDateTime * gnc_g_date_time_new_from_unix_local(time64 time)
Definition: gnc-date.c:141

◆ gnc_date_get_last_mday()

int gnc_date_get_last_mday ( int  month,
int  year 
)

Get the numerical last date of the month. (28, 29, 30, 31)

Definition at line 644 of file gnc-date.c.

645 {
646  static int last_day_of_month[2][12] =
647  {
648  /* non leap */ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
649  /* leap */ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
650  };
651 
652  /* Is this a leap year? */
653  if (year % 2000 == 0) return last_day_of_month[1][month-1];
654  if (year % 400 == 0 ) return last_day_of_month[0][month-1];
655  if (year % 4 == 0 ) return last_day_of_month[1][month-1];
656  return last_day_of_month[0][month-1];
657 }

◆ gnc_date_string_to_dateformat()

gboolean gnc_date_string_to_dateformat ( const gchar *  format_string,
QofDateFormat format 
)

Converts the date format to a printable string.

Note the reversed return values!

Returns
FALSE on success, TRUE on failure.

◆ gnc_date_string_to_monthformat()

gboolean gnc_date_string_to_monthformat ( const gchar *  format_string,
GNCDateMonthFormat format 
)

Converts the month format to a printable string.

Note the reversed return values!

Returns
FALSE on success, TRUE on failure.

◆ gnc_date_timestamp()

char* gnc_date_timestamp ( void  )

Make a timestamp in YYYYMMDDHHMMSS format.

Returns
A pointer to the generated string.
Note
The caller owns this buffer and must g_free it when done.

Definition at line 1415 of file gnc-date.c.

1416 {
1417  GDateTime *gdt = gnc_g_date_time_new_now_local ();
1418  gchar *timestr = g_date_time_format (gdt, "%Y%m%d%H%M%S");
1419  g_date_time_unref (gdt);
1420  return timestr;
1421 }

◆ gnc_difftime()

gdouble gnc_difftime ( const time64  secs1,
const time64  secs2 
)

Find the difference in seconds between two time values.

Parameters
secs1The first time value, in Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)
secs2The second time value, in Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)
Returns
The difference in seconds between secs1 and secs2. If secs2 is later than secs1 the value will be negative.

Definition at line 421 of file gnc-date.c.

422 {
423  return (double)secs1 - (double)secs2;
424 }

◆ gnc_dmy2timespec()

Timespec gnc_dmy2timespec ( gint  day,
gint  month,
gint  year 
)

Convert a day, month, and year to a Timespec, returning the first second of the day

◆ gnc_dmy2timespec_end()

Timespec gnc_dmy2timespec_end ( gint  day,
gint  month,
gint  year 
)

Same as gnc_dmy2timespec, but last second of the day

◆ gnc_dmy2timespec_neutral()

Timespec gnc_dmy2timespec_neutral ( gint  day,
gint  month,
gint  year 
)

Converts a day, month, and year to a Timespec representing 11:00:00 UTC 11:00:00 UTC falls on the same time in almost all timezones, the exceptions being the +13, +14, and -12 timezones used by countries along the International Date Line. Since users in those timezones would see dates immediately change by one day, the function checks the current timezone for those changes and adjusts the UTC time so that the date will be consistent.

◆ gnc_dow_abbrev()

void gnc_dow_abbrev ( gchar *  buf,
int  buf_len,
int  dow 
)

Localized DOW abbreviation.

Parameters
buf_lenat least MIN_BUF_LEN
dowstruct tm semantics: 0=sunday .. 6=saturday

Definition at line 1770 of file gnc-date.c.

1771 {
1772  struct tm my_tm;
1773  int i;
1774 
1775  memset(buf, 0, buf_len);
1776  memset(&my_tm, 0, sizeof(struct tm));
1777  my_tm.tm_wday = dow;
1778  i = qof_strftime(buf, buf_len, "%a", &my_tm);
1779  buf[i] = 0;
1780 }
gsize qof_strftime(gchar *buf, gsize max, const gchar *format, const struct tm *tm)
Definition: gnc-date.c:1369

◆ gnc_g_date_new_today()

GDate* gnc_g_date_new_today ( void  )

Returns a newly allocated date of the current clock time, taken from time(2). The caller must g_date_free() the object afterwards.

Definition at line 1674 of file gnc-date.c.

1675 {
1676  GDateTime *gdt = gnc_g_date_time_new_now_local ();
1677  gint day, month, year;
1678  GDate *result;
1679 
1680  g_date_time_get_ymd (gdt, &year, &month, &day);
1681  result = g_date_new_dmy (day, month, year);
1682  g_date_time_unref (gdt);
1683  g_assert(g_date_valid (result));
1684 
1685  return result;
1686 }

◆ gnc_g_date_time_new_from_timespec_local()

GDateTime* gnc_g_date_time_new_from_timespec_local ( Timespec  tm)

Create a GDateTime from a Timespec.

Parameters
tsA local (int64-based) Timespec
Note
: GDateTimes use microseconds, not nanoseconds, so in theory we lose precision. In practice, there's no portable way to get either.
: Works around the lack of Win32 support in GTimeZone before GLib 2.36.
Returns
A GDateTime pointer. Free it with g_date_time_unref () when you're done with it.

Definition at line 430 of file gnc-date.c.

431 {
432  GDateTime *gdt1 = gnc_g_date_time_new_from_unix_local (ts.tv_sec);
433  double nsecs = ((double)ts.tv_nsec + 0.5)/ 1000000000.0L;
434  GDateTime *gdt2 = NULL;
435  g_return_val_if_fail (gdt1 != NULL, NULL);
436  gdt2 = g_date_time_add_seconds (gdt1, nsecs);
437  g_date_time_unref (gdt1);
438  g_assert (g_date_time_to_unix (gdt2) == ts.tv_sec + (nsecs >= 1.0 ? (gint64)nsecs : 0));
439  return gdt2;
440 }
GDateTime * gnc_g_date_time_new_from_unix_local(time64 time)
Definition: gnc-date.c:141

◆ gnc_g_date_time_new_from_unix_local()

GDateTime* gnc_g_date_time_new_from_unix_local ( time64  time)

Wrapper for g_date_time_new_from_unix_local() that takes special care on windows to take the local time zone into account. On unix, it just calls the g_date function.

Definition at line 141 of file gnc-date.c.

142 {
143  GTimeZone *tz = gnc_g_time_zone_new_local ();
144  GDateTime *gdt = g_date_time_new_from_unix_utc (time);
145  if (gdt)
146  gdt = gnc_g_date_time_adjust_for_dst (gdt, tz);
147  return gdt;
148 }

◆ gnc_gmtime()

struct tm* gnc_gmtime ( const time64 secs)

fill out a time struct from a 64-bit time value

Parameters
secsSeconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)
Returns
A struct tm*, allocated on the heap. Must be freed with gnc_tm_free() The time is UTC.

Definition at line 271 of file gnc-date.c.

272 {
273  struct tm *time;
274  GDateTime *gdt = g_date_time_new_from_unix_utc (*secs);
275  g_return_val_if_fail (gdt != NULL, NULL);
276  time = g_slice_alloc0 (sizeof (struct tm));
277  gnc_g_date_time_fill_struct_tm (gdt, time);
278  g_date_time_unref (gdt);
279  return time;
280 }

◆ gnc_iso8601_to_timespec_gmt()

Timespec gnc_iso8601_to_timespec_gmt ( const gchar *  )

The gnc_iso8601_to_timespec_gmt() routine converts an ISO-8601 style date/time string to Timespec. Please note that ISO-8601 strings are a representation of Universal Time (UTC), and as such, they 'store' UTC. To make them human readable, they show time zone information along with a local-time string. But fundamentally, they are UTC. Thus, this routine takes a UTC input, and returns a UTC output.

For example: 1998-07-17 11:00:00.68-0500 is 680 milliseconds after 11 o'clock, central daylight time It is also 680 milliseconds after 16:00:00 hours UTC.

Returns
The universal time.

XXX Caution: this routine does not handle strings that specify times before January 1 1970.

◆ gnc_localtime()

struct tm* gnc_localtime ( const time64 secs)

fill out a time struct from a 64-bit time value.

Parameters
secsSeconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment).
Returns
A struct tm*, allocated on the heap. Must be freed with gnc_tm_free(). The time is adjusted for the current local time zone.

Definition at line 232 of file gnc-date.c.

233 {
234  struct tm *time = g_slice_alloc0 (sizeof (struct tm));
235  if (gnc_localtime_r (secs, time) == NULL)
236  {
237  gnc_tm_free (time);
238  return NULL;
239  }
240  return time;
241 }
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition: gnc-date.c:249
void gnc_tm_free(struct tm *time)
free a struct tm* created with gnc_localtime() or gnc_gmtime()
Definition: gnc-date.c:209

◆ gnc_localtime_r()

struct tm* gnc_localtime_r ( const time64 secs,
struct tm *  time 
)

fill out a time struct from a 64-bit time value adjusted for the current time zone.

Parameters
secsSeconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)
timeA struct tm* for the function to fill. The time is adjusted for the current local time zone.

Definition at line 249 of file gnc-date.c.

250 {
251  guint index = 0;
252  GDateTime *gdt = gnc_g_date_time_new_from_unix_local (*secs);
253  g_return_val_if_fail (gdt != NULL, NULL);
254 
255  gnc_g_date_time_fill_struct_tm (gdt, time);
256  if (g_date_time_is_daylight_savings (gdt))
257  {
258  index = 1;
259  time->tm_isdst = 1;
260  }
261 
262 #ifdef HAVE_STRUCT_TM_GMTOFF
263  time->tm_gmtoff = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
264 #endif
265 
266  g_date_time_unref (gdt);
267  return time;
268 }
GDateTime * gnc_g_date_time_new_from_unix_local(time64 time)
Definition: gnc-date.c:141

◆ gnc_mktime()

time64 gnc_mktime ( struct tm *  time)

calculate seconds from the epoch given a time struct

Parameters
timeA struct tm* for the function to fill. The time is understood to be in the current local time zone.
Returns
Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment).

Definition at line 340 of file gnc-date.c.

341 {
342  GDateTime *gdt;
343  time64 secs;
344  normalize_struct_tm (time);
345  gdt = gnc_g_date_time_new_local (time->tm_year + 1900, time->tm_mon,
346  time->tm_mday, time->tm_hour,
347  time->tm_min, (gdouble)(time->tm_sec));
348  if (gdt == NULL)
349  {
350  g_warning("Invalid time passed to gnc_mktime");
351  return -1;
352  }
353  time->tm_mon = time->tm_mon > 0 ? time->tm_mon - 1 : 11;
354  // Watch out: struct tm has wday=0..6 with Sunday=0, but GDateTime has wday=1..7 with Sunday=7.
355  time->tm_wday = g_date_time_get_day_of_week (gdt) % 7;
356  time->tm_yday = g_date_time_get_day_of_year (gdt);
357  time->tm_isdst = g_date_time_is_daylight_savings (gdt);
358 
359 #ifdef HAVE_STRUCT_TM_GMTOFF
360  time->tm_gmtoff = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
361 #endif
362 
363  secs = g_date_time_to_unix (gdt);
364  g_date_time_unref (gdt);
365  return secs;
366 }
gint64 time64
Definition: gnc-date.h:79

◆ gnc_print_date()

const char* gnc_print_date ( Timespec  ts)

Convenience; calls through to qof_print_date_dmy_buff(). Return: static global string.

Warning
This routine is not thread-safe, because it uses a single global buffer to store the return value. Use qof_print_date_buff() or qof_print_date() instead.

Definition at line 926 of file gnc-date.c.

927 {
928  static char buff[MAX_DATE_LENGTH];
929  time64 t;
930 
931  memset (buff, 0, sizeof (buff));
932  t = ts.tv_sec + (time64)(ts.tv_nsec / 1000000000.0);
933 
935 
936  return buff;
937 }
#define MAX_DATE_LENGTH
Definition: gnc-date.h:102
gint64 time64
Definition: gnc-date.h:79
size_t qof_print_date_buff(char *buff, size_t len, time64 t)
Definition: gnc-date.c:887

◆ gnc_time()

time64 gnc_time ( time64 tbuf)

get the current local time

Parameters
Atime64* which, if not NULL, will be filled in with the same value as is returned.
Returns
Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)

Definition at line 399 of file gnc-date.c.

400 {
401  GDateTime *gdt = gnc_g_date_time_new_now_local ();
402  time64 secs = g_date_time_to_unix (gdt);
403  g_date_time_unref (gdt);
404  if (tbuf != NULL)
405  *tbuf = secs;
406  return secs;
407 }
gint64 time64
Definition: gnc-date.h:79

◆ gnc_time64_get_day_end()

time64 gnc_time64_get_day_end ( time64  time_val)

The gnc_time64_get_day_end() routine will take the given time in seconds and adjust it to the last second of that day.

Definition at line 1726 of file gnc-date.c.

1727 {
1728  struct tm tm;
1729  time64 new_time;
1730 
1731  gnc_tm_get_day_end(&tm, time_val);
1732  new_time = gnc_mktime(&tm);
1733  return new_time;
1734 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.c:340
gint64 time64
Definition: gnc-date.h:79

◆ gnc_time64_get_day_start()

time64 gnc_time64_get_day_start ( time64  time_val)

The gnc_time64_get_day_start() routine will take the given time in seconds and adjust it to the last second of that day.

Definition at line 1715 of file gnc-date.c.

1716 {
1717  struct tm tm;
1718  time64 new_time;
1719 
1720  gnc_tm_get_day_start(&tm, time_val);
1721  new_time = gnc_mktime(&tm);
1722  return new_time;
1723 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.c:340
gint64 time64
Definition: gnc-date.h:79

◆ gnc_time64_get_today_end()

time64 gnc_time64_get_today_end ( void  )

The gnc_time64_get_today_end() routine returns a time64 value corresponding to the last second of today.

Definition at line 1761 of file gnc-date.c.

1762 {
1763  struct tm tm;
1764 
1765  gnc_tm_get_day_end(&tm, time(NULL));
1766  return gnc_mktime(&tm);
1767 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.c:340

◆ gnc_time64_get_today_start()

time64 gnc_time64_get_today_start ( void  )

The gnc_time64_get_today_start() routine returns a time64 value corresponding to the first second of today.

Definition at line 1752 of file gnc-date.c.

1753 {
1754  struct tm tm;
1755 
1756  gnc_tm_get_day_start(&tm, time(NULL));
1757  return gnc_mktime(&tm);
1758 }
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.c:340

◆ gnc_time_utc()

time64 gnc_time_utc ( time64 tbuf)

get the current UTC time

Parameters
Atime64* which, if not NULL, will be filled in with the same value as is returned.
Returns
Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment)

Definition at line 410 of file gnc-date.c.

411 {
412  GDateTime *gdt = g_date_time_new_now_utc ();
413  time64 secs = g_date_time_to_unix (gdt);
414  g_date_time_unref (gdt);
415  if (tbuf != NULL)
416  *tbuf = secs;
417  return secs;
418 }
gint64 time64
Definition: gnc-date.h:79

◆ gnc_timegm()

time64 gnc_timegm ( struct tm *  time)

calculate seconds from the epoch given a time struct

Parameters
timeA struct tm* for the function to fill. The time is understood to be utc.
Returns
Seconds since 00:00:01 UTC 01 January 1970 (negative values are seconds before that moment).

Definition at line 369 of file gnc-date.c.

370 {
371  GDateTime *gdt;
372  time64 secs;
373  normalize_struct_tm (time);
374  gdt = g_date_time_new_utc (time->tm_year + 1900, time->tm_mon,
375  time->tm_mday, time->tm_hour, time->tm_min,
376  (gdouble)(time->tm_sec));
377  if (gdt == NULL)
378  {
379  PERR("Failed to get valid GDateTime with struct tm: %d-%d-%d %d:%d:%d",
380  time->tm_year + 1900, time->tm_mon, time->tm_mday, time->tm_hour,
381  time->tm_min, time->tm_sec);
382  return 0;
383  }
384  secs = g_date_time_to_unix (gdt);
385  g_date_time_unref (gdt);
386  return secs;
387 }
#define PERR(format, args...)
Definition: qoflog.h:232
gint64 time64
Definition: gnc-date.h:79

◆ gnc_timespec2dmy()

void gnc_timespec2dmy ( Timespec  ts,
gint *  day,
gint *  month,
gint *  year 
)

Set the proleptic Gregorian day, month, and year from a Timespec

Parameters
tsinput timespec
dayoutput day, 1 - 31
monthoutput month, 1 - 12
yearoutput year, 0001 - 9999 CE

◆ gnc_timespec_to_iso8601_buff()

gchar* gnc_timespec_to_iso8601_buff ( Timespec  ts,
gchar *  buff 
)

The gnc_timespec_to_iso8601_buff() routine takes the input UTC Timespec value and prints it as an ISO-8601 style string. The buffer must be long enough to contain the NULL-terminated string (32 characters + NUL). This routine returns a pointer to the null terminator (and can thus be used in the 'stpcpy' metaphor of string concatenation).

Please note that ISO-8601 strings are a representation of Universal Time (UTC), and as such, they 'store' UTC. To make them human readable, they show time zone information along with a local-time string. But fundamentally, they are UTC. Thus, this routine takes a UTC input, and returns a UTC output.

The string generated by this routine uses the local time zone on the machine on which it is executing to create the time string.

◆ gnc_timezone()

glong gnc_timezone ( const struct tm *  tm)

The gnc_timezone function returns the number of seconds west of UTC represented by the tm argument, adjusted for daylight savings time.

This function requires a tm argument returned by localtime or set by mktime. This is a strange function! It requires that localtime or mktime be called before use. Subsequent calls to localtime or mktime may invalidate the result! The actual contents of tm may be used for both time zone offset and daylight savings time, or only daylight savings time! time zone stuff under unix is not standardized and is a big mess.

Definition at line 1610 of file gnc-date.c.

1611 {
1612  g_return_val_if_fail (tm != NULL, 0);
1613 
1614 #ifdef HAVE_STRUCT_TM_GMTOFF
1615  /* tm_gmtoff is seconds *east* of UTC and is
1616  * already adjusted for daylight savings time. */
1617  return -(tm->tm_gmtoff);
1618 #else
1619  {
1620  long tz_seconds;
1621  /* timezone is seconds *west* of UTC and is
1622  * not adjusted for daylight savings time.
1623  * In Spring, we spring forward, wheee! */
1624 # if COMPILER(MSVC)
1625  _get_timezone(&tz_seconds);
1626 # else
1627  tz_seconds = timezone;
1628 # endif
1629  return (long int)(tz_seconds - (tm->tm_isdst > 0 ? 3600 : 0));
1630  }
1631 #endif
1632 }

◆ gnc_tm_free()

void gnc_tm_free ( struct tm *  time)

free a struct tm* created with gnc_localtime() or gnc_gmtime()

Parameters
timeThe struct tm* to be freed.

Definition at line 209 of file gnc-date.c.

210 {
211  g_slice_free1 (sizeof (struct tm), time);
212 }

◆ gnc_tm_get_today_end()

void gnc_tm_get_today_end ( struct tm *  tm)

The gnc_tm_get_today_end() routine takes a pointer to a struct tm and fills it in with the last second of the today.

Definition at line 1746 of file gnc-date.c.

1747 {
1748  gnc_tm_get_day_end(tm, time(NULL));
1749 }

◆ gnc_tm_get_today_start()

void gnc_tm_get_today_start ( struct tm *  tm)

The gnc_tm_get_today_start() routine takes a pointer to a struct tm and fills it in with the first second of the today.

Definition at line 1740 of file gnc-date.c.

1741 {
1742  gnc_tm_get_day_start(tm, time(NULL));
1743 }

◆ qof_date_completion_set()

void qof_date_completion_set ( QofDateCompletion  dc,
int  backmonths 
)

The qof_date_completion_set() routing sets the date completion method to one of QOF_DATE_COMPLETION_THISYEAR (for completing the year to the current calendar year) or QOF_DATE_COMPLETION_SLIDING (for using a sliding 12-month window). The sliding window starts 'backmonth' months before the current month (0-11)

Definition at line 730 of file gnc-date.c.

731 {
732  if (dc == QOF_DATE_COMPLETION_THISYEAR ||
734  {
735  dateCompletion = dc;
736  }
737  else
738  {
739  /* hack alert - Use a neutral default. */
740  PERR("non-existent date completion set attempted. Setting current year completion as default");
741  dateCompletion = QOF_DATE_COMPLETION_THISYEAR;
742  }
743 
744  if (backmonths < 0)
745  {
746  backmonths = 0;
747  }
748  else if (backmonths > 11)
749  {
750  backmonths = 11;
751  }
752  dateCompletionBackMonths = backmonths;
753 
754  return;
755 }
#define PERR(format, args...)
Definition: qoflog.h:232

◆ qof_date_format_get()

QofDateFormat qof_date_format_get ( void  )

The qof_date_format_get routine returns the date format that the date printing will use when printing a date, and the scanning routines will assume when parsing a date.

Returns
: the one of the enumerated date formats.

Definition at line 681 of file gnc-date.c.

682 {
683  return dateFormat;
684 }

◆ qof_date_format_get_string()

const gchar* qof_date_format_get_string ( QofDateFormat  df)

This function returns a strftime formatting string for printing an all numeric date (e.g. 2005-09-14). The string returned is based upon the location specified.

Parameters
dfThe date style (us, uk, iso, etc) that should be provided.
Returns
A formatting string that will print a date in the requested style

Definition at line 764 of file gnc-date.c.

765 {
766  switch (df)
767  {
768  case QOF_DATE_FORMAT_US:
769  return "%m/%d/%y";
770  case QOF_DATE_FORMAT_UK:
771  return "%d/%m/%y";
772  case QOF_DATE_FORMAT_CE:
773  return "%d.%m.%y";
774  case QOF_DATE_FORMAT_UTC:
775  return "%Y-%m-%dT%H:%M:%SZ";
776  case QOF_DATE_FORMAT_ISO:
777  return "%Y-%m-%d";
778  case QOF_DATE_FORMAT_UNSET: // use global
779  return qof_date_format_get_string (dateFormat);
781  default:
782  break;
783  };
784  return GNC_D_FMT;
785 }
const gchar * qof_date_format_get_string(QofDateFormat df)
Definition: gnc-date.c:764

◆ qof_date_format_set()

void qof_date_format_set ( QofDateFormat  df)

The qof_date_format_set() routine sets date format to one of US, UK, CE, OR ISO. Checks to make sure it's a legal value. Args: QofDateFormat: enumeration indicating preferred format

Definition at line 697 of file gnc-date.c.

698 {
699  if (df >= DATE_FORMAT_FIRST && df <= DATE_FORMAT_LAST)
700  {
701  prevQofDateFormat = dateFormat;
702  dateFormat = df;
703  }
704  else
705  {
706  /* hack alert - Use a neutral default. */
707  PERR("non-existent date format set attempted. Setting ISO default");
708  prevQofDateFormat = dateFormat;
709  dateFormat = QOF_DATE_FORMAT_ISO;
710  }
711 
712  return;
713 }
#define PERR(format, args...)
Definition: qoflog.h:232

◆ qof_date_text_format_get_string()

const gchar* qof_date_text_format_get_string ( QofDateFormat  df)

This function returns a strftime formatting string for printing a date using words and numbers (e.g. 2005-September-14). The string returned is based upon the location specified.

Parameters
dfThe date style (us, uk, iso, etc) that should be provided.
Returns
A formatting string that will print a date in the requested style

Definition at line 796 of file gnc-date.c.

797 {
798  switch (df)
799  {
800  case QOF_DATE_FORMAT_US:
801  return "%b %d, %y";
802  case QOF_DATE_FORMAT_UK:
803  case QOF_DATE_FORMAT_CE:
804  return "%d %b, %y";
805  case QOF_DATE_FORMAT_UTC:
806  return "%Y-%m-%dT%H:%M:%SZ";
807  case QOF_DATE_FORMAT_ISO:
808  return "%Y-%b-%d";
809  case QOF_DATE_FORMAT_UNSET: // use global
810  return qof_date_text_format_get_string (dateFormat);
812  default:
813  break;
814  };
815  return GNC_D_FMT;
816 }
const gchar * qof_date_text_format_get_string(QofDateFormat df)
Definition: gnc-date.c:796

◆ qof_print_date()

char* qof_print_date ( time64  secs)

Convenience; calls through to qof_print_date_dmy_buff(). Return: string, which should be freed when no longer needed.

Definition at line 917 of file gnc-date.c.

918 {
919  char buff[MAX_DATE_LENGTH];
920  memset (buff, 0, sizeof (buff));
922  return g_strdup (buff);
923 }
#define MAX_DATE_LENGTH
Definition: gnc-date.h:102
size_t qof_print_date_buff(char *buff, size_t len, time64 t)
Definition: gnc-date.c:887

◆ qof_print_date_buff()

size_t qof_print_date_buff ( char *  buff,
size_t  buflen,
time64  secs 
)

Convenience: calls through to qof_print_date_dmy_buff().

Definition at line 887 of file gnc-date.c.

888 {
889  struct tm theTime;
890  time64 bt = t;
891  size_t actual;
892  if (!buff) return 0 ;
893  if (!gnc_localtime_r(&bt, &theTime))
894  return 0;
895 
896  actual = qof_print_date_dmy_buff (buff, len,
897  theTime.tm_mday,
898  theTime.tm_mon + 1,
899  theTime.tm_year + 1900);
900  return actual;
901 }
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition: gnc-date.c:249
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)
gint64 time64
Definition: gnc-date.h:79

◆ qof_print_date_dmy_buff()

size_t qof_print_date_dmy_buff ( gchar *  buff,
size_t  buflen,
int  day,
int  month,
int  year 
)

qof_print_date_dmy_buff Convert a date as day / month / year integers into a localized string representation

Args: buff - pointer to previously allocated character array; its size must be at lease MAX_DATE_LENTH bytes. len - length of the buffer, in bytes. day - day of the month as 1 ... 31 month - month of the year as 1 ... 12 year - year (4-digit)

Returns: number of characters printed

Globals: global dateFormat value

◆ qof_print_date_time_buff()

size_t qof_print_date_time_buff ( char *  buff,
size_t  len,
time64  secs 
)

Returns the number of bytes printed.

◆ qof_print_gdate()

size_t qof_print_gdate ( char *  buf,
size_t  bufflen,
const GDate *  gd 
)

Convenience; calls through to qof_print_date_dmy_buff().

Definition at line 904 of file gnc-date.c.

905 {
906  GDate date;
907  g_date_clear (&date, 1);
908  date = *gd;
909  gnc_gdate_range_check (&date);
910  return qof_print_date_dmy_buff( buf, len,
911  g_date_get_day(&date),
912  g_date_get_month(&date),
913  g_date_get_year(&date) );
914 }
size_t qof_print_date_dmy_buff(gchar *buff, size_t buflen, int day, int month, int year)

◆ qof_scan_date()

gboolean qof_scan_date ( const char *  buff,
int *  day,
int *  month,
int *  year 
)

qof_scan_date Convert a string into day / month / year integers according to the current dateFormat value.

Args: buff - pointer to date string day - will store day of the month as 1 ... 31 month - will store month of the year as 1 ... 12 year - will store the year (4-digit)

Return: TRUE if the string seemed to be a valid date; else FALSE.

Globals: uses global dateFormat value to assist in parsing.

Definition at line 1232 of file gnc-date.c.

1233 {
1234  return qof_scan_date_internal(buff, day, month, year, dateFormat);
1235 }

◆ qof_strftime()

gsize qof_strftime ( gchar *  buf,
gsize  max,
const gchar *  format,
const struct tm *  tm 
)
Warning
HACK ALERT – the scan and print routines should probably be moved to somewhere else. The engine really isn't involved with things like printing formats. This is needed mostly by the GUI and so on. If a file-io thing needs date handling, it should do it itself, instead of depending on the routines here.qof_strftime calls qof_format_time to print a given time and afterwards tries to put the result into a buffer of fixed size.
Parameters
bufA buffer.
maxThe size of buf in bytes.
formatA format specification in UTF-8.
tmA broken-down time.
Returns
The number of characters written, not include the null byte, if the complete string, including the null byte, fits into the buffer. Otherwise 0.

Definition at line 1369 of file gnc-date.c.

1370 {
1371  gsize convlen, retval;
1372  gchar *convbuf;
1373 
1374  g_return_val_if_fail(buf, 0);
1375  g_return_val_if_fail(max > 0, 0);
1376  g_return_val_if_fail(format, 0);
1377  g_return_val_if_fail(tm, 0);
1378 
1379  convbuf = qof_format_time(format, tm);
1380  if (!convbuf)
1381  {
1382  buf[0] = '\0';
1383  return 0;
1384  }
1385 
1386  convlen = strlen(convbuf);
1387 
1388  if (max <= convlen)
1389  {
1390  /* Ensure only whole characters are copied into the buffer. */
1391  gchar *end = g_utf8_find_prev_char(convbuf, convbuf + max);
1392  g_assert(end != NULL);
1393  convlen = end - convbuf;
1394 
1395  /* Return 0 because the buffer isn't large enough. */
1396  retval = 0;
1397  }
1398  else
1399  {
1400  retval = convlen;
1401  }
1402 
1403  memcpy(buf, convbuf, convlen);
1404  buf[convlen] = '\0';
1405  g_free(convbuf);
1406 
1407  return retval;
1408 }

◆ timespec_abs()

Timespec timespec_abs ( const Timespec *  t)

absolute value, also normalized

Definition at line 611 of file gnc-date.c.

612 {
613  Timespec retval = *t;
614 
615  timespec_normalize(&retval);
616  if (retval.tv_sec < 0)
617  {
618  retval.tv_sec = - retval.tv_sec;
619  retval.tv_nsec = - retval.tv_nsec;
620  }
621 
622  return retval;
623 }

◆ timespec_cmp()

gint timespec_cmp ( const Timespec *  ta,
const Timespec *  tb 
)

comparison: if (ta < tb) -1; else if (ta > tb) 1; else 0;

Definition at line 582 of file gnc-date.c.

583 {
584  Timespec pta, ptb;
585 
586  if (ta == tb) return 0;
587 /* Copy and normalize the copies */
588  pta = *ta;
589  ptb = *tb;
590  timespec_normalize (&pta);
591  timespec_normalize (&ptb);
592 
593  if (pta.tv_sec < ptb.tv_sec) return -1;
594  if (pta.tv_sec > ptb.tv_sec) return 1;
595  if (pta.tv_nsec < ptb.tv_nsec) return -1;
596  if (pta.tv_nsec > ptb.tv_nsec) return 1;
597  return 0;
598 }

◆ timespec_diff()

Timespec timespec_diff ( const Timespec *  ta,
const Timespec *  tb 
)

difference between ta and tb, results are normalized ie tv_sec and tv_nsec of the result have the same size abs(result.tv_nsec) <= 1000000000

Definition at line 601 of file gnc-date.c.

602 {
603  Timespec retval;
604  retval.tv_sec = ta->tv_sec - tb->tv_sec;
605  retval.tv_nsec = ta->tv_nsec - tb->tv_nsec;
606  timespec_normalize(&retval);
607  return retval;
608 }

◆ timespec_equal()

gboolean timespec_equal ( const Timespec *  ta,
const Timespec *  tb 
)

strict equality

Definition at line 565 of file gnc-date.c.

566 {
567  Timespec pta, ptb;
568 
569  if (ta == tb) return TRUE;
570 /* Copy and normalize the copies */
571  pta = *ta;
572  ptb = *tb;
573  timespec_normalize (&pta);
574  timespec_normalize (&ptb);
575 
576  if (pta.tv_sec != ptb.tv_sec) return FALSE;
577  if (pta.tv_nsec != ptb.tv_nsec) return FALSE;
578  return TRUE;
579 }

◆ timespec_now()

Timespec timespec_now ( void  )

Returns the current clock time as a Timespec, taken from time(2).

Definition at line 1643 of file gnc-date.c.

1644 {
1645  Timespec ts;
1646  ts.tv_sec = gnc_time(NULL);
1647  ts.tv_nsec = 0;
1648  return ts;
1649 }
time64 gnc_time(time64 *tbuf)
get the current local time
Definition: gnc-date.c:399

◆ timespec_to_gdate()

GDate timespec_to_gdate ( Timespec  ts)

Turns a Timespec into a GDate

Definition at line 1661 of file gnc-date.c.

1662 {
1663  GDate result;
1664  gint day, month, year;
1665 
1666  g_date_clear (&result, 1);
1667  gnc_timespec2dmy (ts, &day, &month, &year);
1668  g_date_set_dmy (&result, day, month, year);
1669  g_assert(g_date_valid (&result));
1670 
1671  return result;
1672 }
void gnc_timespec2dmy(Timespec ts, gint *day, gint *month, gint *year)

◆ timespecCanonicalDayTime()

Timespec timespecCanonicalDayTime ( Timespec  t)

convert a timepair on a certain day (localtime) to the timepair representing midday on that day. Watch out - this is not the first second of the day, which is returned by various other functions returning a Timespec.

Definition at line 631 of file gnc-date.c.

632 {
633  struct tm tm;
634  Timespec retval;
635  time64 t_secs = t.tv_sec + (t.tv_nsec / NANOS_PER_SECOND);
636  gnc_localtime_r(&t_secs, &tm);
637  gnc_tm_set_day_middle(&tm);
638  retval.tv_sec = gnc_mktime(&tm);
639  retval.tv_nsec = 0;
640  return retval;
641 }
struct tm * gnc_localtime_r(const time64 *secs, struct tm *time)
fill out a time struct from a 64-bit time value adjusted for the current time zone.
Definition: gnc-date.c:249
time64 gnc_mktime(struct tm *time)
calculate seconds from the epoch given a time struct
Definition: gnc-date.c:340
gint64 time64
Definition: gnc-date.h:79

◆ timespecFromTime64()

void timespecFromTime64 ( Timespec *  ts,
time64  t 
)

Turns a time64 into a Timespec

Definition at line 1636 of file gnc-date.c.

1637 {
1638  ts->tv_sec = t;
1639  ts->tv_nsec = 0;
1640 }

◆ timespecToTime64()

time64 timespecToTime64 ( Timespec  ts)

Turns a Timespec into a time64

Definition at line 1652 of file gnc-date.c.

1653 {
1654  return ts.tv_sec;
1655 }

Variable Documentation

◆ gnc_default_strftime_date_format

const char* gnc_default_strftime_date_format

The default date format for use with strftime.

Definition at line 76 of file gnc-date.c.