system_clock
3.0.0, released a year ago by soit.tech
Dart timekeeping facilities to get system uptime and elapsed time.
What it does
Provides timekeeping facilities powered by dart:ffi to easily retrieve system uptime and elapsed realtime. Supports Android, iOS, macOS, Windows, Linux, with web falling back to DateTime.now().
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to measure system uptime excluding deep sleep time.
- You need to measure elapsed realtime including time spent in sleep.
- You need high-resolution timing on supported desktop and mobile platforms.
Skip it when
- You only need standard wall-clock time provided by core Dart libraries.
- You are targeting web platforms where native system clocks are not accessible and fall back to standard time.
Strengths
- Easy to get uptime and elapsed time.
- Cross-platform support including mobile and desktop via FFI.
- Pure Dart package requiring no Flutter plugin dependencies.
Weaknesses
- Web platform is limited to a fallback of DateTime.now().
Setup
- Kind
- FFI (native library)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:system_clock/system_clock.dart';
void main() {
print("system uptime: \${SystemClock.uptime()}");
print("system elapsed realtime: \${SystemClock.elapsedRealtime()}");
}Alternatives
Packages that do the same job and could replace system_clock.
- cryptography_flutter_plus
Flutter plugin to use platform APIs for package:cryptography_plus
73Compare - package_signature
Retrieve Android package signature (SHA1/SHA256) in a Flutter app.
66Compare - cryptography_flutter
Flutter plugin that lets the cryptography package use native OS crypto APIs for faster, compliant operations.
62Compare - daylight
Calculate sunrise and sunset times for a location without using any remote API.
50Compare
Works with
Packages commonly used together with system_clock: ones it builds on, ones built on it, and its own family.