Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boyan01/system_clock
Flutter timekeeping facilities. Powered by `ffi`
https://github.com/boyan01/system_clock
clock dart dartffi flutter-timekeeping-facilities fluttter
Last synced: about 1 month ago
JSON representation
Flutter timekeeping facilities. Powered by `ffi`
- Host: GitHub
- URL: https://github.com/boyan01/system_clock
- Owner: boyan01
- License: apache-2.0
- Created: 2020-08-22T15:35:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-15T13:52:21.000Z (about 2 years ago)
- Last Synced: 2024-10-03T06:21:36.322Z (3 months ago)
- Topics: clock, dart, dartffi, flutter-timekeeping-facilities, fluttter
- Language: C++
- Homepage:
- Size: 289 KB
- Stars: 15
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# system_clock
[![Pub](https://img.shields.io/pub/v/system_clock.svg)](https://pub.dartlang.org/packages/system_clock)
Flutter timekeeping facilities, powered by `dart:ffi`.
support platforms: **Android**、**iOS**、**Macos**、**Windows**、 **linux**
* web is fallback to `DateTime.now()`
## Getting Started
```dart
import 'package:system_clock/system_clock.dart';void main() {
// Duration since boot, not counting time spent in deep sleep.
println("system uptime: ${SystemClock.uptime()}");// Duration since boot, including time spent in sleep.
println("system elapsed realtime: ${SystemClock.elapsedRealtime()}");
}```
## Refs
https://android.googlesource.com/platform/frameworks/base/+/56a2301/core/java/android/os/SystemClock.java
https://android.googlesource.com/platform/frameworks/base/+/master/core/jni/android_os_SystemClock.cpp
https://android.googlesource.com/platform/frameworks/native/+/android-4.2.2_r1/include/utils/Timers.h
https://android.googlesource.com/platform/system/core/+/master/libutils/Timers.cpp
https://github.com/boyan01/system_clock/issues/3#issue-710700921