aboutsummaryrefslogtreecommitdiff
path: root/admin/api/serverTime.php
blob: a64a39ee891864db48bef3f9234163a54168b5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";

$str   = file_get_contents('/proc/uptime');
$num   = floatval($str);
$secs  = fmod($num, 60); $num = intdiv($num, 60);
$mins  = $num % 60;      $num = intdiv($num, 60);
$hours = $num % 24;      $num = intdiv($num, 24);
$days  = $num;

echo(l($days . " day·s, " . $hours . " hour·s, " . $mins . " minute·s, " . ceil($secs) . " second·s", $days . " jour·s, " . $hours . " heure·s, " . $mins . " minute·s, " . ceil($secs) . " seconde·s"));