Giter Club home page Giter Club logo

Comments (4)

aschamberger avatar aschamberger commented on June 5, 2024

The calendar object sets or resets the dst offset according to the given date, Are you sure you didn't have a default timezone that does not have a DST or used a historic date that didn't have DST yet.

from calimero-core.

Snickermicker avatar Snickermicker commented on June 5, 2024

Yes, you're right. My testcase was wrong. Wrote it without thinking about different timezones.

But, the translator's setData() method accepts 1900/01/01 00:00:00 DST (0x00 01 01 20 00 00 01 00) without throwing and so does getValue() returning "1900/1/1, Mon (no workday) 0:0:0 DST, no sync". This fails only when using getValueMilliseconds() where an exception is thrown.
Btw: same behavior when setting 2014-07-31 00:00:00 (without DST flag being set).
Question I have is: when is the byte data validated? I might (wrongly) assume that setData() should do that.

from calimero-core.

bmalinowsky avatar bmalinowsky commented on June 5, 2024

Actually, this is described in the API doc. The reasons for that behavior are, that

  1. the KNX DPT specification does not require any valid date/times (besides valid ranges per field).
  2. a valid date/time item does not require to have filled in all fields
  3. calendars can differ.

Therefore, unconditional calendar validation might fail unexpectedly, although the datapoint value is valid. You could never translate data that does not pass your calendar. Those two are different requirements on the data (valid calendar time being stronger).
getValueMilliseconds returns the UTC milliseconds based on your calendar's epoch (to be useful), calendar validation is important.

Answer: If you want the date/times to be validated against your calendar, call validate.

from calimero-core.

Snickermicker avatar Snickermicker commented on June 5, 2024

Thx for letting me know.

from calimero-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.