GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

Date and Time handling routines. More...

#include <glib-object.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  timespec64
 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
 
typedef struct timespec64 Timespec
 

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
}
 
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)
 
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_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)
 

Variables

const char * gnc_default_strftime_date_format
 

GValue

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

Today's Date

#define MIN_BUF_LEN   10
 
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)
 

Detailed Description

Date and Time handling routines.

Definition in file gnc-date.h.