![]() |
![]() |
![]() |
libjana Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites |
struct JanaDuration; JanaTime; guint8 jana_time_get_seconds (JanaTime *self
); guint8 jana_time_get_minutes (JanaTime *self
); guint8 jana_time_get_hours (JanaTime *self
); guint8 jana_time_get_day (JanaTime *self
); guint8 jana_time_get_month (JanaTime *self
); guint16 jana_time_get_year (JanaTime *self
); gboolean jana_time_get_isdate (JanaTime *self
); gboolean jana_time_get_daylight (JanaTime *self
); gchar * jana_time_get_tzname (JanaTime *self
); glong jana_time_get_offset (JanaTime *self
); void jana_time_set_seconds (JanaTime *self
,gint seconds
); void jana_time_set_minutes (JanaTime *self
,gint minutes
); void jana_time_set_hours (JanaTime *self
,gint hours
); void jana_time_set_day (JanaTime *self
,gint day
); void jana_time_set_month (JanaTime *self
,gint month
); void jana_time_set_year (JanaTime *self
,gint year
); void jana_time_set_isdate (JanaTime *self
,gboolean isdate
); void jana_time_set_tzname (JanaTime *self
,const gchar *tzname
); void jana_time_set_offset (JanaTime *self
,glong offset
); JanaTime * jana_time_duplicate (JanaTime *self
); JanaDuration * jana_duration_new (JanaTime *start
,JanaTime *end
); JanaDuration * jana_duration_copy (JanaDuration *duration
); void jana_duration_set_start (JanaDuration *self
,JanaTime *start
); void jana_duration_set_end (JanaDuration *self
,JanaTime *end
); gboolean jana_duration_valid (JanaDuration *self
); void jana_duration_free (JanaDuration *self
);
JanaTime is the interface for representing a time. It has functions to set all the components of a basic calendar time, including date and timezone.
struct JanaDuration { JanaTime *start; JanaTime *end; };
This struct specifies a time period.
guint8 jana_time_get_seconds (JanaTime *self
);
Get the seconds component of the time. See jana_time_set_seconds()
.
|
A JanaTime |
Returns : |
The seconds component of the time. |
guint8 jana_time_get_minutes (JanaTime *self
);
Get the minutes component of the time. See jana_time_set_minutes()
.
|
A JanaTime |
Returns : |
The minutes component of the time. |
guint8 jana_time_get_hours (JanaTime *self
);
Get the hours component of the time. See jana_time_set_hours()
.
|
A JanaTime |
Returns : |
The hours component of the time. |
guint8 jana_time_get_day (JanaTime *self
);
Get the day component of the time. See jana_time_set_day()
.
|
A JanaTime |
Returns : |
The day component of the time. |
guint8 jana_time_get_month (JanaTime *self
);
Get the month component of the time. See jana_time_set_month()
.
|
A JanaTime |
Returns : |
The month component of the time. |
guint16 jana_time_get_year (JanaTime *self
);
Get the year component of the time. See jana_time_set_year()
.
|
A JanaTime |
Returns : |
The year component of the time. |
gboolean jana_time_get_isdate (JanaTime *self
);
Determines whether the time has been set as a date-only time. See
jana_time_set_isdate()
.
gboolean jana_time_get_daylight (JanaTime *self
);
Determines whether the time is in daylight savings or not. See
jana_time_set_daylight()
.
gchar * jana_time_get_tzname (JanaTime *self
);
Retrieves the timezone of the time. See jana_time_set_tzname()
.
|
A JanaTime |
Returns : |
The timezone name, e.g. "GMT/BST", "EST", etc. |
glong jana_time_get_offset (JanaTime *self
);
Gets the UTC (Universal Time Co-ordinated) offset of the time, in seconds.
See jana_time_set_offset()
.
|
A JanaTime |
Returns : |
The offset, in seconds, over UTC. |
void jana_time_set_seconds (JanaTime *self
,gint seconds
);
Sets the seconds component of the time. If the seconds parameter is invalid, the time will be normalised. For example, a seconds parameter of -1 would cause the minutes to be decreased by 1 and the seconds to be set to 59. If normalisation causes the time to cross the daylight savings boundary of the set timezone, the time will be adjusted accordingly.
|
A JanaTime |
|
The seconds component to set |
void jana_time_set_minutes (JanaTime *self
,gint minutes
);
Sets the minutes component of the time. If the minutes parameter is invalid, the time will be normalised. For example, a minutes parameter of -1 would cause the hours to be decreased by 1 and the minutes to be set to 59. If normalisation causes the time to cross the daylight savings boundary of the set timezone, the time will be adjusted accordingly.
|
A JanaTime |
|
The minutes component to set |
void jana_time_set_hours (JanaTime *self
,gint hours
);
Sets the hours component of the time. If the hours parameter is invalid, the time will be normalised. For example, an hours parameter of -1 would cause the date to be decreased by 1 day and the hours to be set to 23. If normalisation causes the time to cross the daylight savings boundary of the set timezone, the time will be adjusted accordingly.
|
A JanaTime |
|
The hours component to set |
void jana_time_set_day (JanaTime *self
,gint day
);
Sets the day component of the time. If the day parameter is invalid, the time will be normalised. For example, a day parameter of 0 would cause the date to be set to the last day of the previous month. If normalisation causes the time to cross the daylight savings boundary of the set timezone, the time will be adjusted accordingly.
|
A JanaTime |
|
The day component to set |
void jana_time_set_month (JanaTime *self
,gint month
);
Sets the month component of the time. If the day parameter is invalid, the time will be normalised. For example, a month parameter of 0 would cause the date to be set to the last month of the previous year. If normalisation causes the time to cross the daylight savings boundary of the set timezone, the time will be adjusted accordingly.
|
A JanaTime |
|
The month component to set |
void jana_time_set_year (JanaTime *self
,gint year
);
Sets the year component of the time. The time may be normalised in the situation that the year is adjusted from a leap year to a non-leap year and the month and day was set to the 29th of February. In this situation, the month and day would be adjusted to the 1st of March.
|
A JanaTime |
|
The year component to set |
void jana_time_set_isdate (JanaTime *self
,gboolean isdate
);
Sets whether the time should be considered only as a date. The seconds,
minutes and hours components of the time are not guaranteed to be
preserved when isdate
is TRUE
.
|
A JanaTime |
|
Whether the time should be considered only as a date |
void jana_time_set_tzname (JanaTime *self
,const gchar *tzname
);
Sets the timezone of the time. The time offset will also be adjusted to an offset that corresponds to the newly set timezone. If there is an offset for the newly set timezone that is the same as the previously set offset, the offset will remain unchanged. In addition, the time will be adjusted by the difference between the old offset and the new offset.
|
A JanaTime |
|
The timezone to set |
void jana_time_set_offset (JanaTime *self
,glong offset
);
Sets the offset of the time. The timezone will also be adjusted to a zone that corresponds to the newly set offset. If there is a zone for the newly set offset that is the same as the previously set zone, the zone will remain unchanged. In addition, the time will be adjusted by the difference between the old offset and the new offset.
|
A JanaTime |
|
The time offset to set |
JanaTime * jana_time_duplicate (JanaTime *self
);
Creates a copy of self
.
|
A JanaTime |
Returns : |
A new copy of self . |
JanaDuration * jana_duration_new (JanaTime *start
,JanaTime *end
);
Creates a new JanaDuration.
|
The start of the duration, or NULL
|
|
The end of the duration, or NULL
|
Returns : |
A newly allocated JanaDuration, to be freed with
jana_duration_free() . |
JanaDuration * jana_duration_copy (JanaDuration *duration
);
Create a copy of a JanaDuration.
|
A JanaDuration |
Returns : |
A copy of duration . |
void jana_duration_set_start (JanaDuration *self
,JanaTime *start
);
Sets the start of the duration.
|
A JanaDuration |
|
The start time, or NULL
|
void jana_duration_set_end (JanaDuration *self
,JanaTime *end
);
Sets the end of the duration.
|
A JanaDuration |
|
The end time, or NULL
|
gboolean jana_duration_valid (JanaDuration *self
);
Determines whether the duration is valid. For the duration to be valid, the start and end must be set, and the end must occur on or after the start.
|
A JanaDuration |
Returns : |
TRUE if the duration is valid, FALSE otherwise. |
void jana_duration_free (JanaDuration *self
);
Frees the memory associated with a JanaDuration.
|
A JanaDuration |