upTimeInfo top-level property

String? get upTimeInfo

Implementation

String? get upTimeInfo {
  if (Dart.isAndroid) {
    // try {
    //   return DateTime.now().difference(DateTime.parse("2024-02-24 14:40:01"));
    // } catch (e) {
    //   print(e);
    // }
    return ((Process.runSync("uptime", ["-p"])).stdout.toString().trim());
    // return Duration.zero;
  }

  return ((Process.runSync("uptime", ["-p"])).stdout.toString().trim());
  // double? secondsPassed = double.tryParse((File("/proc/uptime").readAsStringSync()).split(" ").first);
  // // secondsPassed.printPretty();
  // if (secondsPassed == null) return null;
  // return Duration(seconds: secondsPassed.floor());
}