On 07/07/2015 09:47 AM, Rohan Arora wrote:
> I am able to get the tv_sec and tv_usec properties from the result using
> "result.contents.timestamp.tv_sec", but I don't know how to convert that
> back into an actual timestamp with format, say, "MM/dd/yyy HH:mm:ss". Is
> there a way to do this?
That's a generic python question, not really pcp related.
Basically, use datetime.fromtimestamp() to convert the tv_sec/tv_usec
values to a python datetime object, then use the strftime() function to
format it however you want.
<https://stackoverflow.com/questions/15649942/python-convert-epoch-time-with-nanoseconds-to-human-readable>
<https://stackoverflow.com/questions/10611328/format-nanoseconds-in-python>
--
David Smith
dsmith@xxxxxxxxxx
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
|