Open tomekit opened 2 months ago
Summary: The statSync()
method in Dart returns the file modification time with millisecond precision, while the stat
command in bash provides nanosecond precision. The user requests support for retrieving the modification time with full nanosecond precision in Dart.
@tomekit supporting precision down to the nanosecond would mean we would have to change Dart's DateTime class (https://api.flutter.dev/flutter/dart-core/DateTime-class.html) to include a DateTime.fromNanosecondsSinceEpoch class. This is a breaking change. A much easier change would be for us to support microseconds precision from the statSync call, this would be supported on platforms that support microsecond precision from the stat call (linux, macos..) and on windows we would still maintain the millisecond precision as the _wstat64 call on Windows only supports that.
I am calling
statSync()
on file and getting modtime with ms precision:2024-09-02 09:57:59.602
.If I call bash CLI:
stat <filename>
I get full ns precision:2024-09-02 09:57:59.602813345
. I am using EXT4 filesystem.By any chance is it possible to get the modtime with full available precision down to the nanosecond?
Dart/Flutter
statSync()
:Bash
stat
:Dart version and tooling diagnostic info (
dart info
)Dart 3.4.4 (stable) (Wed Jun 12 15:54:31 2024 +0000) on "linux_x64"
on linux / Linux 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 2 20:41:06 UTC 2024
locale is en_US.UTF-8
Whether you are using Windows, macOS, or Linux (if applicable)