Skip to content
pubscout

system_clock

3.0.0, released a year ago by soit.tech

Dart timekeeping facilities to get system uptime and elapsed time.

WASM-ready
$ flutter pub add system_clock
Source repository

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.

Works with

Packages commonly used together with system_clock: ones it builds on, ones built on it, and its own family.