Zeitgeist.Timestamp – zeitgeist-2.0 – Vala Binding Reference

Zeitgeist.Timestamp – zeitgeist-2.0 Reference Manual

# Zeitgeist.Timestamp

## Description:

Convenience functions for dealing with timestamps and dates

include: zeitgeist.h

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.

## Content:

### Constants:

- public const `int64` SECOND
  A second represented as a Zeitgeist timestamp (ie. 1000ms)
- public const `int64` MINUTE
  A minute represented as a Zeitgeist timestamp (ie. 60000ms)
- public const `int64` HOUR
  An hour represented as a Zeitgeist timestamp (ie. 3600000ms)
- public const `int64` DAY
  A day represented as a Zeitgeist timestamp (ie. 86400000ms)
- public const `int64` WEEK
  A week represented as a Zeitgeist timestamp (ie. 604800000ms)
- public const `int64` YEAR
  A year represented as a Zeitgeist timestamp (ie. 31556952000ms). Be warned that a year is not 365 days, but in fact 365.2425 days, to account for leap years.

### Functions:

- public `int64` from_timeval (`TimeVal` timeval)
  Convert a `GLib.TimeVal` to an amount of milliseconds since the Unix Epoch
- public `TimeVal` to_timeval (`int64` timestamp)
  Write a Zeitgeist timestamp to a `GLib.TimeVal` instance. Note that Zeitgeist uses only a millisecond resolution, whereas `GLib.TimeVal` has microsecond resolution. This means that the lower three digits of @tv.tv_usec will always be 0.
- public `int64` from_now ()
  Return the current timestamp in milliseconds.
- public `int64` from_iso8601 (`string` datetime)
  Parse a timestamp from an ISO8601-encoded string.
- public `string` to_iso8601 (`int64` timestamp)
  Convert a timestamp to a human-readable ISO8601 format
- public `int64` from_date (`Date` date)
  Convert a GDate to a Zeitgeist timestamp
- public `int64` from_dmy (`DateDay` day, `DateMonth` month, `DateYear` year)
  Convert a day, month, year tuple into a Zeitgeist timestamp
- public `Date` to_date (`int64` timestamp)
  Write a timestamp to a `GLib.Date` structure
- public `int64` next_midnight (`int64` timestamp)
  Calculate the timestamp for the next midnight after the given timestamp.
- public `int64` prev_midnight (`int64` timestamp)
  Calculate the timestamp for the midnight just before the given timestamp.