How to convert a time string in GMT to seconds since the epochRecently, I've run into a situation where I have an ASCII string representing a time, expressed in UTC/GMT, and I want to convert it to the standard Unix representation of seconds since the epoch. It turns out that there are some interesting issues involved (well, in my opinion). Doing this for a time string in local time is a snap: (To the documentation's credit, there is a mention of this at the bottom of the time module, although it is somewhat obscure and easy to miss. (I did the first time around.))
The (While it would also be out of place in a wrapper module, this isn't something programmers using the module should really have to care about. What's implemented by the C library and what's implemented in C by the Python runtime is an implementation detail.) |
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |