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

Module Contents

Functions

seconds([seconds])

returns a datetime.timedelta object representing the specified number of seconds"

minutes([minutes])

returns a datetime.timedelta object representing the specified number of minutes

hours([hours])

returns a datetime.timedelta object representing the specified number of hours

days([days])

returns a datetime.timedelta object representing the specified number of hours"

weeks([weeks])

returns a datetime.timedelta object representing the specified number of weeks"

Attributes

now

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