GithubHelp home page GithubHelp logo

Comments (4)

mattt avatar mattt commented on July 21, 2024

Thanks for bringing this to my attention, @kirilltitov.

The underlying issue was a typo in the code, where the format byte d8 was provided instead of c7 for timestamp 96 messages. The crashing behavior in your provided code sample was caused by an unhandled error resulting from the decoder not knowing how to interpret the c7 format byte.

This is now fixed by 49019b2, which also includes passing tests. Please let me know if you find any other issues!

from messagepack.

kirilltitov avatar kirilltitov commented on July 21, 2024

Not completely fixed. Current date (Date()) is still in 1984 (though distantPast and distantFuture are fixed)

from messagepack.

mattt avatar mattt commented on July 21, 2024

Hmm... I can't reproduce this. I added a test to manually check the encoding logic with c78ad55, and it appears to work as expected according to the spec.

timestamp 32 stores the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC
in an 32-bit unsigned integer:
+--------+--------+--------+--------+--------+--------+
|  0xd6  |   -1   |   seconds in 32-bit unsigned int  |
+--------+--------+--------+--------+--------+--------+

Likewise with the expected encoding and decoding tests, which produce D6 FF and 32-bit-aligned 1.

let date = Date(timeIntervalSince1970: 1)
let value = try! encoder.encode(date)
// [0xD6, 0xFF, 0x00, 0x00, 0x00, 0x01]

If you're still having issues, can you please submit a new PR with a failing test?

from messagepack.

kirilltitov avatar kirilltitov commented on July 21, 2024

There you go — #7.

from messagepack.

Related Issues (11)

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.