gnome.scripting.time_utils¶
Handy utilities for working with time
Internally, py_Gnome uses datetime.timedelta
objects to represent time spans.
But it is a bit awkward to create these objects:
datetime.timedelta(seconds=3600)
The time_utils module provides handy utilities to make it easier to construct these objects.
Examples:
hours()
– represents one hour
hours(12)
– represents 12 hours
As these functions return timedelta objects, you can do math with them:
seconds() * 60
days(2) + hours(12)
etc…
These are the full set:
seconds
minutes
hours
days
weeks
Attributes¶
Functions¶
|
returns a datetime.timedelta object representing the specified number of seconds" |
|
returns a datetime.timedelta object representing the specified number of minutes |
|
returns a datetime.timedelta object representing the specified number of hours |
|
returns a datetime.timedelta object representing the specified number of hours" |
|
returns a datetime.timedelta object representing the specified number of weeks" |
Module Contents¶
- gnome.scripting.time_utils.now¶
- gnome.scripting.time_utils.seconds(seconds=1)¶
returns a datetime.timedelta object representing the specified number of seconds”
- Parameters:
seconds=1
- gnome.scripting.time_utils.minutes(minutes=1)¶
returns a datetime.timedelta object representing the specified number of minutes
- Parameters:
minutes=1
- gnome.scripting.time_utils.hours(hours=1)¶
returns a datetime.timedelta object representing the specified number of hours
- Parameters:
hours=1
- gnome.scripting.time_utils.days(days=1)¶
returns a datetime.timedelta object representing the specified number of hours”
- Parameters:
hours=1
- gnome.scripting.time_utils.weeks(weeks=1)¶
returns a datetime.timedelta object representing the specified number of weeks”
- Parameters:
weeks=1