def __init__(self, at=None, timezone="local"):
        """Create a ``TimeStamp`` object.

        Parameters
        ----------
        at : float (optional)
            Seconds since epoch (unix time). If None, current time will be
            used. Default is None.
        timezone : string or integer (optional)
            String (one in {'local', 'utc'} or seconds offset from UTC. Default
            is local.

        Attributes
        ----------
        unix : float
            Seconds since epoch (unix time).
        date : string
            Date.
        hms : string
            Hours, minutes, seconds.
        human : string
            Representation of the timestamp meant to be human readable.
        legacy : string
            Legacy WrightTools timestamp representation.
        RFC3339 : string
            `RFC3339`__ representation (recommended for most applications).

            __ https://www.ietf.org/rfc/rfc3339.txt
        RFC5322 : string
            `RFC5322`__ representation.

            __ https://tools.ietf.org/html/rfc5322#section-3.3
        path : string
            Representation of the timestamp meant for inclusion in filepaths.


        """
        # get timezone
        if timezone == "local":
            self.tz = tz.tzlocal()
        elif timezone == "utc":
            self.tz = tz.UTC
        elif type(timezone) in [int, float]:
            self.tz = tz.tzoffset(None, timezone)
        else:
            raise KeyError
        # get unix timestamp
        if at is None:
            self.unix = time.time()
        else:
            self.unix = at
        # get now
        if at is None:
            self.datetime = datetime.datetime.now(self.tz)
        else:
            self.datetime = datetime.datetime.fromtimestamp(at, self.tz)
def __init__ ( self , at = None , timezone = "local" ) : if timezone == "local" : self . tz = tz . tzlocal ( ) elif timezone == "utc" : self . tz = tz . UTC elif type ( timezone ) in [ int , float ] : self . tz = tz . tzoffset ( None , timezone ) else : raise KeyError if at is None : self . unix = time . time ( ) else : self . unix = at if at is None : self . datetime = datetime . datetime . now ( self . tz ) else : self . datetime = datetime . datetime . fromtimestamp ( at , self . tz )
Create a ``TimeStamp`` object.

        Parameters
        ----------
        at : float (optional)
            Seconds since epoch (unix time). If None, current time will be
            used. Default is None.
        timezone : string or integer (optional)
            String (one in {'local', 'utc'} or seconds offset from UTC. Default
            is local.

        Attributes
        ----------
        unix : float
            Seconds since epoch (unix time).
        date : string
            Date.
        hms : string
            Hours, minutes, seconds.
        human : string
            Representation of the timestamp meant to be human readable.
        legacy : string
            Legacy WrightTools timestamp representation.
        RFC3339 : string
            `RFC3339`__ representation (recommended for most applications).

            __ https://www.ietf.org/rfc/rfc3339.txt
        RFC5322 : string
            `RFC5322`__ representation.

            __ https://tools.ietf.org/html/rfc5322#section-3.3
        path : string
            Representation of the timestamp meant for inclusion in filepaths.