[Tutor] Support for datetime module

Johan Geldenhuys johan at accesstel.com.au
Sun Sep 7 12:17:56 CEST 2008


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"

Do you think it will be difficult to work this out with the datetime module?

Any suggestion would be greatly appreciated.

Thanks

Johan

-----Original Message-----
From: kent3737 at gmail.com [mailto:kent3737 at gmail.com] On Behalf Of Kent
Johnson
Sent: Saturday, 6 September 2008 23:08 PM
To: johan at accesstel.com.au
Cc: tutor at python.org
Subject: Re: [Tutor] Support for datetime module

On Sat, Sep 6, 2008 at 2:42 AM, Johan Geldenhuys <johan at accesstel.com.au>
wrote:
> Hi all,
>
> I have want to use the datetime module on a system with ver 2.2.3
installed.
> I know it's very old, but that's what I have to deal with and can't
upgrade.
> So please don't suggest that.
>
> As you know datetime was available from version 2.3.
>
>
>
> I want to know where can I get the datetime module so that I can include
it
> in my package that I use on my device?

datetime is implemented in C so getting the version from 2.3 to work
on 2.2 might be difficult.

Apparently the version in the std lib is derived from a Python version
that was part of Zope, this might be helpful if you can find the
source it refers to:
http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage

Kent



More information about the Tutor mailing list