-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsoasc_timestamp.php
More file actions
26 lines (22 loc) · 847 Bytes
/
soasc_timestamp.php
File metadata and controls
26 lines (22 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* DeepSID
*
* Calculates the difference between the current time and the timestamp that
* was specified, then returns the difference in minutes.
*
* This could have been done in jQuery, but the original timestamp was saved by
* the 'soasc_status.php' and I wanted to make sure this was solid, including
* the use of daylight saving time.
*
* @uses $_GET['timestamp'] time in 'YYYY-MM-DD HH:MM:SS' format
*
* @used-by N/A
*/
require_once("class.account.php"); // Includes setup
if (!isset($_GET['timestamp']))
die(json_encode(array('status' => 'error', 'message' => 'You must specify \'timestamp\' as a GET variable.')));
$now = strtotime(date('Y-m-d H:i:s', strtotime(TIME_ADJUST)));
$timestamp = strtotime($_GET['timestamp']);
die(json_encode(array('status' => 'ok', 'minutes' => ($now - $timestamp) / 60)));
?>