Module glib::date [] [src]

Date and Time Functions — calendrical calculations and miscellaneous time stuff

Structs

Date
TimeVal

Represents a precise time, with seconds and microseconds. Similar to the struct timeval returned by the gettimeofday() UNIX system call.

Enums

Month

Enumeration representing a month; values are G_DATE_JANUARY, G_DATE_FEBRUARY, etc. G_DATE_BAD_MONTH is the invalid value.

Weekday

Enumeration representing a day of the week; G_DATE_MONDAY, G_DATE_TUESDAY, etc. G_DATE_BAD_WEEKDAY is an invalid weekday.

Functions

get_current_time

Equivalent to the UNIX gettimeofday() function, but portable.

get_days_in_month

Returns the number of days in a month, taking leap years into account.

get_monday_weeks_in_year

Returns the number of weeks in the year, where weeks are taken to start on Monday. Will be 52 or 53. The date must be valid. (Years always have 52 7-day periods, plus 1 or 2 extra days depending on whether it's a leap year. This function is basically telling you how many Mondays are in the year, i.e. there are 53 Mondays if one of the extra days happens to be a Monday.)

get_monotonic_time

Queries the system monotonic time.

get_real_time

Queries the system wall-clock time.

get_sunday_weeks_in_year

Returns the number of weeks in the year, where weeks are taken to start on Sunday. Will be 52 or 53. The date must be valid. (Years always have 52 7-day periods, plus 1 or 2 extra days depending on whether it's a leap year. This function is basically telling you how many Sundays are in the year, i.e. there are 53 Sundays if one of the extra days happens to be a Sunday.)

is_leap_year

Returns TRUE if the year is a leap year.

is_valid_day

Returns true if the day of the month is valid (a day is valid if it's between 1 and 31 inclusive).

is_valid_dmy

Returns true if the day-month-year triplet forms a valid, existing day in the range of days GDate understands (Year 1 or later, no more than a few thousand years in the future).

is_valid_julian

Returns true if the Julian day is valid. Anything greater than zero is basically a valid Julian, though there is a 32-bit limit.

is_valid_month

Returns true if the month value is valid. The 12 GDateMonth enumeration values are the only valid months.

is_valid_weekday

Returns true if the weekday is valid. The seven GDateWeekday enumeration values are the only valid weekdays.

is_valid_year

Returns true if the year is valid. Any year greater than 0 is valid, though there is a 16-bit limit to what GDate will understand.

usleep

Pauses the current thread for the given number of microseconds.

Type Definitions

Day

Integer representing a day of the month; between 1 and 31. G_DATE_BAD_DAY represents an invalid day of the month.

Time

Simply a replacement for time_t. It has been deprecated since it is not equivalent to time_t on 64-bit platforms with a 64-bit time_t. Unrelated to GTimer.

Year

Integer representing a year; G_DATE_BAD_YEAR is the invalid value. The year must be 1 or higher; negative (BC) years are not allowed. The year is represented with four digits.