Top | ![]() |
![]() |
![]() |
![]() |
gint64 | zeitgeist_timestamp_for_now () |
gint64 | zeitgeist_timestamp_from_date () |
gint64 | zeitgeist_timestamp_from_dmy () |
gint64 | zeitgeist_timestamp_from_iso8601 () |
gint64 | zeitgeist_timestamp_from_timeval () |
gint64 | zeitgeist_timestamp_next_midnight () |
gint64 | zeitgeist_timestamp_prev_midnight () |
void | zeitgeist_timestamp_to_date () |
gchar * | zeitgeist_timestamp_to_iso8601 () |
void | zeitgeist_timestamp_to_timeval () |
#define | ZEITGEIST_TIMESTAMP_SECOND |
#define | ZEITGEIST_TIMESTAMP_MINUTE |
#define | ZEITGEIST_TIMESTAMP_HOUR |
#define | ZEITGEIST_TIMESTAMP_DAY |
#define | ZEITGEIST_TIMESTAMP_WEEK |
#define | ZEITGEIST_TIMESTAMP_YEAR |
A suite of convenience functions for dealing with timestamps and dates.
Zeitgeist timestamps are represented as gint64s with the number of milliseconds since the Unix Epoch.
gint64
zeitgeist_timestamp_for_now (void
);
Get the timestamp for the current system time
gint64
zeitgeist_timestamp_from_date (GDate *date
);
Convert a GDate to a Zeitgeist timestamp.
gint64 zeitgeist_timestamp_from_dmy (GDateDay day
,GDateMonth month
,GDateYear year
);
Convert a day, month, year tuple into a Zeitgeist timestamp
gint64
zeitgeist_timestamp_from_iso8601 (const gchar *datetime
);
Parse a timestamp from a ISO8601 encoded string.
gint64
zeitgeist_timestamp_next_midnight (gint64 timestamp
);
Calculate the timestamp for the next midnight after timestamp
gint64
zeitgeist_timestamp_prev_midnight (gint64 timestamp
);
Calculate the timestamp for the midnight just before timestamp
Returns the timestamp for the first midnight just before timestamp
.
If timestamp
is already midnight (down to the millisecond) this
method will return the value for the midnight before. In other words
you can call this method recursively in order to iterate, backwards
in time, over midnights.
void zeitgeist_timestamp_to_date (gint64 timestamp
,GDate *date
);
Write a timestamp to a GDate structure
gchar *
zeitgeist_timestamp_to_iso8601 (gint64 timestamp
);
Convert a timestamp to a human readable ISO8601 format
void zeitgeist_timestamp_to_timeval (gint64 timestamp
,GTimeVal *tv
);
Write a Zeitgeist timestamp to a GTimeVal instance. Note that Zeitgeist
uses only a millisecond resolution for where GTimeVal uses a microsecond
resolution, meaning that the lower three digits of tv.tv_usec
will
be 0.
#define ZEITGEIST_TIMESTAMP_SECOND G_GINT64_CONSTANT (1000)
A second represented as a Zeitgeist timestamp (ie. 1000ms)
#define ZEITGEIST_TIMESTAMP_MINUTE G_GINT64_CONSTANT (60000)
A minute represented as a Zeitgeist timestamp (ie. 60000ms)
#define ZEITGEIST_TIMESTAMP_HOUR G_GINT64_CONSTANT (3600000)
An hour represented as a Zeitgeist timestamp (ie. 3600000ms)
#define ZEITGEIST_TIMESTAMP_DAY G_GINT64_CONSTANT (86400000)
A day represented as a Zeitgeist timestamp (ie. 86400000ms)
#define ZEITGEIST_TIMESTAMP_WEEK G_GINT64_CONSTANT (604800000)
A week represented as a Zeitgeist timestamp (ie. 604800000ms)