[Tutor] Support for datetime module
Johan Geldenhuys
johan at accesstel.com.au
Sun Sep 7 21:48:25 CEST 2008
I can get the time up to the closest second with the time module, but not to
the millisecond.
When I use time.strftime, I don't know how many milliseconds are left over
to use them.
-----Original Message-----
From: kent3737 at gmail.com [mailto:kent3737 at gmail.com] On Behalf Of Kent
Johnson
Sent: Sunday, 7 September 2008 21:04 PM
To: johan at accesstel.com.au
Cc: tutor at python.org
Subject: Re: [Tutor] Support for datetime module
On Sun, Sep 7, 2008 at 6:17 AM, Johan Geldenhuys <johan at accesstel.com.au>
wrote:
> Thanks Kent,
>
> Let me explain what I need it for.
>
> I have a systemUpTime is seconds that I got from a SNMP agent.
>
> I want to work out when the system uptime began and want to put that in
ISO
> format time to the millisecond.
>
> So my idea is to take a timestamp in seconds when I get the systemUpTime.
I
> subtract the uptime from my timestamp and then format that into ISO
format.
> That should give me a fairly accurate UTC-like time of when the
systemUpTime
> began.
> Here is an example: "2008-09-04 22:29:43.221 Z"
I think you can do all that with functions in the time module.
Kent
More information about the Tutor
mailing list