Main Page Modules Alphabetical List Data Structures File List Data Fields Globals

# date.h File Reference

Date handling routines. More...

`#include <glib.h>`
`#include <time.h>`

## Data Structures

struct | timespec64

## Timespec functions

gboolean | timespec_equal (const Timespec *ta, const Timespec *tb)
int | 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)
void | timespecFromTime_t (Timespec *ts, time_t t)
time_t | timespecToTime_t (Timespec ts)
Timespec | gnc_dmy2timespec (int day, int month, int year)
Timespec | gnc_dmy2timespec_end (int day, int month, int year)
Timespec | gnc_iso8601_to_timespec_local (const char *)
Timespec | gnc_iso8601_to_timespec_gmt (const char *)
char * | gnc_timespec_to_iso8601_buff (Timespec ts, char *buff)
void | gnc_timespec2dmy (Timespec ts, int *day, int *month, int *year)

## DateFormat functions

DateFormat | getDateFormat (void)
void | setDateFormat (DateFormat df)
const gchar * | getDateFormatString (DateFormat df)
const gchar * | getDateTextFormatString (DateFormat df)

## Date Printing/Scanning functions

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.

void | printDate (char *buff, int day, int month, int year)
void | printDateSecs (char *buff, time_t secs)
void | printGDate (char *buf, GDate *gd)
char * | xaccPrintDateSecs (time_t secs)
const char * | gnc_print_date (Timespec ts)
char * | xaccDateUtilGetStamp (time_t thyme)
char | dateSeparator (void)
void | scanDate (const char *buff, int *day, int *month, int *year)
time_t | xaccScanDateS (const char *buff)

## Date Start/End Adjustment routines

Given a time value, adjust it to be the beginning or end of that day.
void | gnc_tm_get_day_start (struct tm *tm, time_t time_val)
void | gnc_tm_get_day_end (struct tm *tm, time_t time_val)
time_t | gnc_timet_get_day_start (time_t time_val)
time_t | gnc_timet_get_day_end (time_t time_val)
int | date_get_last_mday (struct tm *tm)
gboolean | date_is_last_mday (struct tm *tm)
int | gnc_date_my_last_mday (int month, int year)
int | gnc_timespec_last_mday (Timespec ts)

## Today's Date

void | gnc_tm_get_today_start (struct tm *tm)
void | gnc_tm_get_today_end (struct tm *tm)
time_t | gnc_timet_get_today_start (void)
time_t | gnc_timet_get_today_end (void)
char * | xaccDateUtilGetStampNow (void)

## Defines

#define | DATE_FORMAT_FIRST DATE_FORMAT_US
#define | DATE_FORMAT_LAST DATE_FORMAT_LOCALE
#define | MAX_DATE_LENGTH 11

## Typedefs

typedef timespec64 | Timespec

## Enumerations

enum | DateFormat { DATE_FORMAT_US, DATE_FORMAT_UK, DATE_FORMAT_CE, DATE_FORMAT_ISO, DATE_FORMAT_LOCALE, DATE_FORMAT_CUSTOM }

## Functions

void | date_add_months (struct tm *tm, int months, gboolean track_last_day)
time_t | xaccDMYToSec (int day, int month, int year)
long int | gnc_timezone (struct tm *tm)

## Detailed Description

Date handling routines.

Utility functions to handle the date (adjusting, get current date, etc.)

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.

Author:
  Copyright (C) 1997 Robin D. Clark , Copyright (C) 1998,1999,2000 Linas Vepstas <linas@linas.org>