ICalGLib.Time

g GObject.Object GObject.Object ICalGLib.Object ICalGLib.Object GObject.Object->ICalGLib.Object ICalGLib.Time ICalGLib.Time ICalGLib.Object->ICalGLib.Time

Subclasses:

None

Methods

Inherited:

ICalGLib.Object (11), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

days_in_month (month, year)

class

days_in_year (year)

class

days_is_leap_year (year)

class

new ()

class

new_current_with_zone (zone)

class

new_from_day_of_year (day, year)

class

new_from_string (str)

class

new_from_timet_with_zone (v, is_date, zone)

class

new_null_date ()

class

new_null_time ()

class

new_today ()

class

timezone_expand_vtimezone (comp, end_year, changes)

add (d)

adjust (days, hours, minutes, seconds)

as_ical_string ()

as_timet ()

as_timet_with_zone (zone)

clone ()

compare (b)

compare_date_only (b)

compare_date_only_tz (b, zone)

convert_timezone (from_zone, to_zone)

convert_to_zone (zone)

convert_to_zone_inplace (zone)

day_of_week ()

day_of_year ()

get_date ()

get_day ()

get_hour ()

get_minute ()

get_month ()

get_second ()

get_time ()

get_timezone ()

get_tzid ()

get_year ()

is_date ()

is_daylight ()

is_null_time ()

is_utc ()

is_valid_time ()

normalize ()

normalize_inplace ()

set_date (year, month, day)

set_day (day)

set_hour (hour)

set_is_date (is_date)

set_is_daylight (is_daylight)

set_minute (minute)

set_month (month)

set_second (second)

set_time (hour, minute, second)

set_timezone (zone)

set_year (year)

start_doy_week (fdow)

subtract (t2)

week_number ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

ICalGLib.Object (5)

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class ICalGLib.Time(**kwargs)
Bases:

ICalGLib.Object

Abstract:

No

Structure:

ICalGLib.TimeClass

This is the ICalGLib.Time instance.

classmethod days_in_month(month, year)
Parameters:
  • month (int) – The target month

  • year (int) – The target year

Returns:

The number of days in the target month in the target year.

Return type:

int

Gets the number of days in the target month in the target year.

New in version 1.0.

classmethod days_in_year(year)
Parameters:

year (int) – The target year

Returns:

Days in this year.

Return type:

int

Returns the number of days in this year.

New in version 2.0.

classmethod days_is_leap_year(year)
Parameters:

year (int) – The target year

Returns:

Whether the year is a leap year

Return type:

bool

Checks whether a year is a leap year.

New in version 1.0.

classmethod new()
Returns:

The newly created ICalGLib.Time. It is a null time

Return type:

ICalGLib.Time

Creates a new ICalGLib.Time.

New in version 1.0.

classmethod new_current_with_zone(zone)
Parameters:

zone (ICalGLib.Timezone or None) – The timezone used to create a ICalGLib.Time according to the current time

Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a ICalGLib.Time according to the timezone and current time.

New in version 1.0.

classmethod new_from_day_of_year(day, year)
Parameters:
  • day (int) – The day of a year

  • year (int) – The year

Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a new time, given a day of year and a year.

New in version 1.0.

classmethod new_from_string(str)
Parameters:

str (str) – The ISO format string

Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a time from an ISO format string.

New in version 1.0.

classmethod new_from_timet_with_zone(v, is_date, zone)
Parameters:
  • v (int) – The seconds past since epoch time

  • is_date (int) – Whether it is a date type, 1 if yes, 0 if not

  • zone (ICalGLib.Timezone or None) – The timezone, or None

Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Converts seconds past UNIX epoch to a timetype, using timezones.

New in version 1.0.

classmethod new_null_date()
Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a null date, which indicates no time has been set.

New in version 1.0.

classmethod new_null_time()
Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a default time which is an epoch time.

New in version 1.0.

classmethod new_today()
Returns:

The newly created ICalGLib.Time

Return type:

ICalGLib.Time

Creates a ICalGLib.Time representing today.

New in version 1.0.

classmethod timezone_expand_vtimezone(comp, end_year, changes)
Parameters:

Applies a list of timezone changes on the array of components until the end year.

New in version 2.0.

add(d)
Parameters:

d (ICalGLib.Duration) – A ICalGLib.Duration as the difference

Returns:

The ICalGLib.Time results. The native object is the same. But since it is a bare object, so it won’t cause segmentation.

Return type:

ICalGLib.Time

Adds a time duration on the time.

New in version 2.0.

adjust(days, hours, minutes, seconds)
Parameters:
  • days (int) – Difference of days adjusted

  • hours (int) – Difference of hours adjusted

  • minutes (int) – Difference of minutes adjusted

  • seconds (int) – Difference of seconds adjusted

Adds or subtracts a number of days, hours, minutes and seconds from self.

New in version 1.0.

as_ical_string()
Returns:

The string representation

Return type:

str

Returns a string representation of the time, in RFC2445 format.

New in version 1.0.

as_timet()
Returns:

The time as seconds past the UNIX epoch

Return type:

int

Returns the time as seconds past the UNIX epoch.

New in version 1.0.

as_timet_with_zone(zone)
Parameters:

zone (ICalGLib.Timezone or None) – The timezone

Returns:

The time as seconds past the UNIX epoch

Return type:

int

Returns the time as seconds past the UNIX epoch, using timezones.

New in version 1.0.

clone()
Returns:

The newly created ICalGLib.Time, copy of self.

Return type:

ICalGLib.Time

Creates a new ICalGLib.Time, copy of self.

New in version 1.0.

compare(b)
Parameters:

b (ICalGLib.Time) – The ICalGLib.Time to be compared

Returns:

-1, 0, or 1 to indicate that a less than b, a==b or a larger than b.

Return type:

int

ICalGLib.Time.compare returns an integer indicating the result of the comparison, as follow:

New in version 1.0.

compare_date_only(b)
Parameters:

b (ICalGLib.Time) – The ICalGLib.Time to be compared

Returns:

-1, 0, or 1 to indicate that a less than b, a==b or a larger than b.

Return type:

int

Like ICalGLib.Time.compare(), but only use the date parts.

New in version 1.0.

compare_date_only_tz(b, zone)
Parameters:
Returns:

-1, 0, or 1 to indicate that a less than b, a==b or a larger than b.

Return type:

int

Like i_cal_time_compare_tz(), but only use the date parts; accepts timezone.

New in version 1.0.

convert_timezone(from_zone, to_zone)
Parameters:

Convert time from one timezone to another.

New in version 1.0.

convert_to_zone(zone)
Parameters:

zone (ICalGLib.Timezone or None) – The target timezone

Returns:

The converted ICalGLib.Time

Return type:

ICalGLib.Time

Converts self to zone and return new ICalGLib.Time object.

New in version 1.0.

convert_to_zone_inplace(zone)
Parameters:

zone (ICalGLib.Timezone or None) – The target timezone

Converts self to zone and store the result into self.

New in version 3.0.5.

day_of_week()
Returns:

The day of the week of the given time. Sunday is 1.

Return type:

int

Returns the day of the week of the given time. Sunday is 1.

New in version 1.0.

day_of_year()
Returns:

The day of the year of the given time

Return type:

int

Returns the day of the year of the given time.

New in version 1.0.

get_date()
Returns:

year:

Out parameter for the ‘year’ part of the date

month:

Out parameter for the ‘month’ part of the date

day:

Out parameter for the ‘day’ part of the date

Return type:

(year: int, month: int, day: int)

Gets the year/month/date parts of the self in one call.

New in version 1.0.

get_day()
Returns:

The day.

Return type:

int

Gets the day of ICalGLib.Time.

New in version 1.0.

get_hour()
Returns:

The hour.

Return type:

int

Gets the hour of ICalGLib.Time.

New in version 1.0.

get_minute()
Returns:

The minute.

Return type:

int

Gets the minute of ICalGLib.Time.

New in version 1.0.

get_month()
Returns:

The month.

Return type:

int

Gets the month of ICalGLib.Time.

New in version 1.0.

get_second()
Returns:

The second.

Return type:

int

Gets the second of ICalGLib.Time.

New in version 1.0.

get_time()
Returns:

hour:

Out parameter for the ‘hour’ part of the time

minute:

Out parameter for the ‘minute’ part of the time

second:

Out parameter for the ‘second’ part of the time

Return type:

(hour: int, minute: int, second: int)

Gets the hour/minute/second parts of the self in one call.

New in version 1.0.

get_timezone()
Returns:

The timezone information

Return type:

ICalGLib.Timezone

Returns the timezone, the ICalGLib.Timezone object is cached and can be either unreferenced once the last instance is used or can be kept until ICalGLib.Object.free_global_objects() is called (usually at the very end of the program).

New in version 1.0.

get_tzid()
Returns:

The tzid of ICalGLib.Time, or None if floating type

Return type:

str or None

Returns the tzid, or None for a floating time.

New in version 1.0.

get_year()
Returns:

The year.

Return type:

int

Gets the year of ICalGLib.Time.

New in version 1.0.

is_date()
Returns:

True if time is of DATE type, false if DATE-TIME.

Return type:

bool

Returns true if time is of DATE type, false if DATE-TIME.

New in version 1.0.

is_daylight()
Returns:

The is_daylight.

Return type:

bool

Gets the is_daylight of ICalGLib.Time.

New in version 1.0.

is_null_time()
Returns:

Whether self is null_time. 1 if yes, 0 if not.

Return type:

bool

Returns true if the time is null.

New in version 1.0.

is_utc()
Returns:

True if time is relative to UTC zone.

Return type:

bool

Returns true if time is relative to UTC zone.

New in version 1.0.

is_valid_time()
Returns:

Whether self is null_time. 1 if yes, 0 if not.

Return type:

bool

Returns true if the time is null.

New in version 1.0.

normalize()
Returns:

The ICalGLib.Time normalized

Return type:

ICalGLib.Time

Normalizes the icaltime, so that all fields are within the normal range.

New in version 1.0.

normalize_inplace()

Normalizes the self, so that all fields are within the normal range.

New in version 3.0.5.

set_date(year, month, day)
Parameters:
  • year (int) – The ‘year’ part of the date

  • month (int) – The ‘month’ part of the date

  • day (int) – The ‘day’ part of the date

Sets the year/month/date parts of the self in one call. This doesn’t verify validity of the given date.

New in version 1.0.

set_day(day)
Parameters:

day (int) – The day

Sets the day of ICalGLib.Time.

New in version 1.0.

set_hour(hour)
Parameters:

hour (int) – The hour

Sets the hour of ICalGLib.Time.

New in version 1.0.

set_is_date(is_date)
Parameters:

is_date (bool) – The is_date

Sets the is_date of ICalGLib.Time.

New in version 1.0.

set_is_daylight(is_daylight)
Parameters:

is_daylight (bool) – The is_daylight

Sets the is_daylight of ICalGLib.Time.

New in version 1.0.

set_minute(minute)
Parameters:

minute (int) – The minute

Sets the minute of ICalGLib.Time.

New in version 1.0.

set_month(month)
Parameters:

month (int) – The month

Sets the month of ICalGLib.Time.

New in version 1.0.

set_second(second)
Parameters:

second (int) – The second

Sets the second of ICalGLib.Time.

New in version 1.0.

set_time(hour, minute, second)
Parameters:
  • hour (int) – The ‘hour’ part of the time

  • minute (int) – The ‘minute’ part of the time

  • second (int) – The ‘second’ part of the time

Sets the hour/minute/second parts of the self in one call. This doesn’t verify validity of the given time.

New in version 1.0.

set_timezone(zone)
Parameters:

zone (ICalGLib.Timezone or None) – The timezone

Sets the timezone of the self.

New in version 1.0.

set_year(year)
Parameters:

year (int) – The year

Sets the year of ICalGLib.Time.

New in version 1.0.

start_doy_week(fdow)
Parameters:

fdow (int) – The first day of the week

Returns:

The day of the year for the Sunday of the week that the given time is within.

Return type:

int

Returns the day of the year for the first day of the week that the given time is within.

New in version 1.0.

subtract(t2)
Parameters:

t2 (ICalGLib.Time) – The subtracting ICalGLib.Time

Returns:

The ICalGLib.Duration between two ICalGLib.Time.

Return type:

ICalGLib.Duration

Gets the duration between two time.

New in version 2.0.

week_number()
Returns:

The week number for the week the given time is within.

Return type:

int

Returns the week number for the week the given time is within.

New in version 1.0.