Functions
mycroft.util.time Namespace Reference

Functions

def default_timezone ()
 
def now_local (tz=None)
 
def now_utc ()
 
def to_local (dt)
 
def to_system (dt)
 
def to_utc (dt)
 

Function Documentation

def mycroft.util.time.default_timezone ( )
Get the default timezone

Based on user location settings location.timezone.code or
the default system value if no setting exists.

Returns:
    (datetime.tzinfo): Definition of the default timezone

Definition at line 21 of file time.py.

def mycroft.util.time.now_local (   tz = None)
Retrieve the current time

Args:
    tz (datetime.tzinfo, optional): Timezone, default to user's settings

Returns:
    (datetime): The current time

Definition at line 54 of file time.py.

def mycroft.util.time.now_utc ( )
Retrieve the current time in UTC

Returns:
    (datetime): The current time in Universal Time, aka GMT

Definition at line 45 of file time.py.

def mycroft.util.time.to_local (   dt)
Convert a datetime to the user's local timezone

Args:
    dt (datetime): A datetime (if no timezone, defaults to UTC)
Returns:
    (datetime): time converted to the local timezone

Definition at line 83 of file time.py.

def mycroft.util.time.to_system (   dt)
Convert a datetime to the system's local timezone

Args:
    dt (datetime): A datetime (if no timezone, assumed to be UTC)
Returns:
    (datetime): time converted to the operation system's timezone

Definition at line 98 of file time.py.

def mycroft.util.time.to_utc (   dt)
Convert a datetime with timezone info to a UTC datetime

Args:
    dt (datetime): A datetime (presumably in some local zone)
Returns:
    (datetime): time converted to UTC

Definition at line 68 of file time.py.



mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:41