Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scans.log (at least) is not storing time correctly #13

Open
johnmckerrell opened this issue Aug 22, 2019 · 2 comments
Open

scans.log (at least) is not storing time correctly #13

johnmckerrell opened this issue Aug 22, 2019 · 2 comments
Labels

Comments

@johnmckerrell
Copy link
Member

johnmckerrell commented Aug 22, 2019

While looking for a scan on the doorbots I found that they don't appear to be logging scans in the way we expect them to. The log file claims to be storing UTC times when in fact it appears to be using local time. I'm not sure where it's even getting the local time zone from but the following appears to suggest it:

94fa5964	2019-08-22 16:14:18 UTC
7b60b555	2019-08-22 20:00:46 UTC
pi@doorbot5:~/logcards $ date
Thu 22 Aug 19:08:26 UTC 2019

As you can see the last scan was apparently at 20:00 UTC, when the time is actually 19:08 UTC. To confirm this was actually at 20:08 BST/local time.

@johnmckerrell
Copy link
Member Author

Ah, so appears this is a feature:

# Optional timezone, used for defining half-days of hotdesking
    timezone: "Europe/London"

and

       time = Time.now.utc
        if LCConfig.tz
          time = LCConfig.tz.utc_to_local(time)
        end
        today = Date.today.to_s
        scansFile.write("#{uid}\t#{time}\n")

Annoying that we end up stating UTC when its not so I'll leave this open to see if we can fix that. If not maybe we just make sure the scans file does store UTC.

@ajlennon
Copy link

I’m not understanding why the string representation of a local time would expand to a UTC time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants