Comments (4)
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.
Not completely fixed. Current date (Date()
) is still in 1984 (though distantPast
and distantFuture
are fixed)
from messagepack.
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.
There you go — #7.
from messagepack.
Related Issues (11)
- FixedWidthInteger bytes implementation is wrong? HOT 1
- Decode unsigned integers as signed integers HOT 4
- Encode unsigned ints provided as signed ints HOT 11
- Decode & encode functions are not public HOT 2
- Broken decoding of optional struct HOT 1
- fatalError when decoding a struct with 16-element array property HOT 3
- Performance Characteristics HOT 3
- Decoding Double as Float HOT 1
- crash when encoding classes that have multiple CodingKeys because of inheritance
- URLs don't encode/decode properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from messagepack.