Top | ![]() |
![]() |
![]() |
![]() |
typedef | mrptime |
#define | MRP_TIME_INVALID |
#define | MRP_TIME_MIN |
#define | MRP_TIME_MAX |
enum | MrpTimeUnit |
MrpTime |
Two APIs co-exists: Calendar time with mrptime and broken-down time with MrpTime.
libplanner does not use MrpTime.
ISO 8601 representation is done in the basic format.
Less separators are used:
20150101T000000Z
for 2015-01-01T00:00:00Z
.
mrptime
mrp_time_current_time (void
);
Retrieves the current time as an mrptime value.
mrptime mrp_time_compose (gint year
,gint month
,gint day
,gint hour
,gint minute
,gint second
);
Composes an mrptime value from the separate components.
gboolean mrp_time_decompose (mrptime t
,gint *year
,gint *month
,gint *day
,gint *hour
,gint *minute
,gint *second
);
Splits up an mrptime value into its components.
mrptime mrp_time_from_string (const gchar *str
,GError **err
);
Parses an ISO8601 time string and converts it to an mrptime.
gchar *
mrp_time_to_string (mrptime t
);
Converts a time value to an ISO8601 string.
mrptime
mrp_time_from_msdate_string (const gchar *str
);
mrptime
mrp_time_align_day (mrptime t
);
Aligns a time value to the start of the day.
mrptime mrp_time_align_prev (mrptime t
,MrpTimeUnit unit
);
Align t
to the previous unit
.
mrptime mrp_time_align_next (mrptime t
,MrpTimeUnit unit
);
Align t
to the next unit
.
gint
mrp_time_day_of_week (mrptime t
);
Retrieves the day of week of the specified time.
gint
mrp_time_week_number (mrptime t
);
Retrieves the week number of the specified time.
const gchar *
mrp_time_day_name (mrptime t
);
Retrieves the name of the day of the specified time.
const gchar *
mrp_time_month_name (mrptime t
);
Retrieves the name of the month of the specified time.
const gchar *
mrp_time_month_name_initial (mrptime t
);
Retrieves the initial letter for the month of the specified time.
gchar * mrp_time_format (const gchar *format
,mrptime t
);
Formats a string with time values.
The following format codes are allowed:
%a: the abbreviated weekday name (Mon, Tue, ...)
%A: the full weekday name (Monday, Tuesday, ...)
%b: the abbreviated month name (Jan, Feb, ...)
%B: the full month name (January, February, ...)
%d: the day of the month (01 - 31).
%e: the day of the month (1 - 31).
%H: the hour using a 24-hour clock (00 - 23).
%I: the hour using a 12-hour clock (01 - 12).
%j: the day of the year (001 - 366).
%k: the hour using a 24-hour clock (0 to 23).
%l: the hour using a 12-hour clock (1 - 12).
%m: the month number (01 to 12).
%M: the minute (00 - 59).
%p: either 'AM' or 'PM' according to the given time value.
%P: like %p but in lowercase.
%R: the time in 24 hour notation (%H:%M).
%S: the second (00 - 61).
%U: the week number, (1 - 53), starting with the first Sunday as the first day of week 1.
%W: the week number, (1 - 53), starting with the first Monday as the first day of week 1.
%y: the year without a century (range 00 to 99).
%Y: the year including the century.
gchar *
mrp_time_format_locale (mrptime t
);
Formats a string with time values. For format is the preferred for the current locale.
void
mrp_time_debug_print (mrptime t
);
Prints the time on stdout, for debugging purposes.
GParamSpec * mrp_param_spec_time (const gchar *name
,const gchar *nick
,const gchar *blurb
,GParamFlags flags
);
Convenience function for creating a GParamSpec carrying an mrptime value.
mrptime
mrp_time_from_tm (struct tm *tm
);
Converts a struct tm value to an mrptime value.
void mrp_time2_set_date (MrpTime *t
,gint year
,gint month
,gint day
);
Set t
date.
void mrp_time2_set_time (MrpTime *t
,gint hour
,gint min
,gint sec
);
Set t
time.
void mrp_time2_get_date (MrpTime *t
,gint *year
,gint *month
,gint *day
);
Get t
time.
void mrp_time2_get_time (MrpTime *t
,gint *hour
,gint *min
,gint *sec
);
Get t
time.
void mrp_time2_subtract_years (MrpTime *t
,gint years
);
Subtract years
from t
.
void mrp_time2_subtract_months (MrpTime *t
,gint months
);
Subtract months
from t
.
void mrp_time2_subtract_days (MrpTime *t
,gint days
);
Subtract days
from t
.
void mrp_time2_subtract_hours (MrpTime *t
,gint64 hours
);
Subtract hours
from t
.
void mrp_time2_subtract_minutes (MrpTime *t
,gint64 mins
);
Subtract mins
from t
.
void mrp_time2_subtract_seconds (MrpTime *t
,gint64 secs
);
Subtract secs
from t
.
void
mrp_time2_debug_print (MrpTime *t
);
Prints the time on stdout, for debugging purposes.
gboolean mrp_time2_set_from_string (MrpTime *t
,const gchar *str
);
Set t
according to str
.
Three formats are recognized "yyyymmddTHHMMSS"
, "yyyymmddTHHMMSSZ"
, and
"yyyymmdd"
. The last is a date, the time part of t
is not modified.
mrp_time2_set_from_string(t, "20041231")
is not equivalent to
mrp_time2_set_from_string(t, "20041231T000000Z")
.
gchar *
mrp_time2_to_string (MrpTime *t
);
Build an ISO 8601 representation for t
.
void mrp_time2_set_epoch (MrpTime *t
,time_t epoch
);
Set t
according to the calendar time epoch
.
time_t
mrp_time2_get_epoch (MrpTime *t
);
Return the calendar time corresponding to t
.
const gchar *
mrp_time2_get_day_name (MrpTime *t
);
Retrieves the name of the day of the specified time.
const gchar *
mrp_time2_get_month_name (MrpTime *t
);
Retrieves the name of the month of the specified time.
const gchar *
mrp_time2_get_month_initial (MrpTime *t
);
Retrieves the initial letter for the month of the specified time.
gint mrp_time2_get_week_number (MrpTime *t
,gint *year
);
Retrieves the week number of the specified time.
void mrp_time2_align_prev (MrpTime *t
,MrpTimeUnit unit
);
Align t
to the previous unit
.
void mrp_time2_align_next (MrpTime *t
,MrpTimeUnit unit
);
Align t
to the next unit
.