Created with <3 with dartpad.dev.
Last active
September 10, 2022 16:35
-
-
Save Roms1383/31bcd2c74cb3e23dc4dd33176bfa224f to your computer and use it in GitHub Desktop.
lossy conversion ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final past_ms = -150151152153154; | |
final future_ms = 150151152153154; | |
final past = DateTime.fromMicrosecondsSinceEpoch(past_ms, isUtc: true); | |
print('$past (ms ${past.microsecondsSinceEpoch})'); | |
final future = DateTime.fromMicrosecondsSinceEpoch(future_ms, isUtc: true); | |
print('$future (ms ${future.microsecondsSinceEpoch})'); | |
} |
Tested on stable: Flutter 3.3.1
Dart 2.18.0
.
update: conversion isn't lossy on platform other than web and DartPad
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well actually it gets weirder when comparing with different
int
sizes, see this another gist.