Skip to content

Commit

Permalink
Merge pull request #25 from msgpack/feature/update_for_squeak6-2
Browse files Browse the repository at this point in the history
- Use bitAnd: , bitOr: for compatibility
  • Loading branch information
mumez authored Feb 3, 2024
2 parents 483a536 + 3623d08 commit 7750299
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ readTimestamp64: aStream
| nanosAndSeconds nanos seconds |
nanosAndSeconds := MpPortableUtil default readUint64From: aStream.
nanos := nanosAndSeconds >> 34.
seconds := nanosAndSeconds & 16r00000003ffffffff.
seconds := nanosAndSeconds bitAnd: 16r00000003ffffffff.
^MpPortableUtil default timestampFromSeconds: seconds nanos: nanos
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ writeTimestamp: timestamp
nanos := secondsArray at: 2.
(seconds >> 34) == 0 ifFalse: [ ^ self writeTimestamp96: seconds nanos: nanos ].
(nanos == 0 and: [seconds < 4294967296]) ifTrue: [ ^self writeTimestamp32: seconds ].
nanosAndSeconds := (nanos << 34) | seconds.
nanosAndSeconds := (nanos << 34) bitOr: seconds.
^self writeTimestamp64: nanosAndSeconds
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
actions
timestampFromSeconds: seconds nanos: nanoSeconds
| microseconds ts |
microseconds := (seconds * 1000000) + (nanoSeconds * 0.001).
microseconds := seconds * 1000000.
nanoSeconds isZero ifFalse: [ | microsPart rem |
rem := nanoSeconds rem: 1000.
rem = 0 ifTrue: [
microsPart := nanoSeconds / 1000.
] ifFalse: [
microsPart := nanoSeconds * 0.001.
].
microseconds := microseconds + microsPart.
].
ts := DateAndTime utcMicroseconds: microseconds offset: 0.
^ts

0 comments on commit 7750299

Please sign in to comment.