Skip to content

Date&Time issue, bare metal in CEST timezone #27

@x8k

Description

@x8k

Hello, I'm experiencing a strange behavior with the plugin.
I've the bare-metal in CEST (+0200) that runs the docker plugins inside a docker image running with -v /var/run/docker.sock:/var/run/docker.sock:ro option.
The t = stats['read'] has value like "2016-04-13T14:44:03.808905789+02:00"
When the plugin run the if below use the time.mktime() function

if t:
            val.time = time.mktime(dateutil.parser.parse(t).timetuple())
        else:
            val.time = time.time()

And from documentation: The timetuple parameter given to mktime() doesn't contain any time zone information (it never does, there is no time zone field in a timetuple). Therefore the function has to "guess" which time zone it might be, and mktime() just always assumes that it is local time. That's just how the function behaves.
That means the plugin sends the metrics 2 hours in the future :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions