VirtualBox

Changeset 83585 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Apr 6, 2020 10:58:19 AM (5 years ago)
Author:
vboxsync
Message:

common/utils.py: Added getShortIsoTimestamp and formatShortIsoTimestamp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/common/utils.py

    r83416 r83585  
    15101510    return formatIsoTimestamp(datetime.datetime.utcnow());
    15111511
     1512def formatShortIsoTimestamp(oNow):
     1513    """Formats the datetime object as an ISO timestamp, but w/o microseconds."""
     1514    assert oNow.tzinfo is None or isinstance(oNow.tzinfo, UtcTzInfo);
     1515    return oNow.strftime('%Y-%m-%dT%H:%M:%SZ');
     1516
     1517def getShortIsoTimestamp():
     1518    """Returns the current UTC timestamp as a string, but w/o microseconds."""
     1519    return formatShortIsoTimestamp(datetime.datetime.utcnow());
     1520
    15121521def convertDateTimeToZulu(oDateTime):
    15131522    """ Converts oDateTime to zulu time if it has timezone info. """
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette