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

:local_date_time always calculated as CET #3

Open
ikbenben opened this issue Feb 26, 2018 · 3 comments
Open

:local_date_time always calculated as CET #3

ikbenben opened this issue Feb 26, 2018 · 3 comments

Comments

@ikbenben
Copy link
Contributor

It seems like the code assumes that the user is always in the CET timezone based on the code in Message#process_value. Is this correct? and expected behaviour?

  def process_value(type, val)
    if type[:type][0..3].to_sym == :enum
      val = Sdk.enum(type[:type])[val]
    elsif type[:type] == :date_time
      t = Time.new(1989, 12, 31, 0, 0, 0, '+00:00').utc.to_i
      Time.at(val + t).utc
    elsif type[:type] == :local_date_time
      t = Time.new(1989, 12, 31, 0, 0, 0, '+02:00').utc.to_i
      val = Time.at(val + t)
    elsif type[:type] == :coordinates
      val *= (180.0 / 2**31)
    end
@richardbrodie
Copy link
Owner

Since I live in the CET timezone and I'm rather lazy I would say it's "intended behaviour", but it's certainly not correct.

Can you think of a good way to solve this?

@ikbenben
Copy link
Contributor Author

I thought that might be the case...I'm similar :) I'll take a look and see if I can see a solution. I'll submit a PR if I can.

@richardbrodie
Copy link
Owner

Great! I'll give it a ponder myself, but I probably won't be able to get it fixed for a few days. So if you get a PR together before I do then I'll happily accept it.

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

No branches or pull requests

2 participants