Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Replaces repo commit with timestamp

Author Dave Jarvis <email>
Date 2026-02-08 16:57:50 GMT-0800
Commit 360ce85c56280d2b762158d703fb969d45d2f1ac
Parent 017554f
Delta 26 lines added, 1 line removed, 25-line increase
new/index.php
}
+function time_elapsed_string($timestamp) {
+ if (!$timestamp) return 'never';
+
+ $diff = time() - $timestamp;
+ if ($diff < 5) return 'just now';
+
+ $tokens = [
+ 31536000 => 'year',
+ 2592000 => 'month',
+ 604800 => 'week',
+ 86400 => 'day',
+ 3600 => 'hour',
+ 60 => 'minute',
+ 1 => 'second'
+ ];
+
+ foreach ($tokens as $unit => $text) {
+ if ($diff < $unit) continue;
+ $numberOfUnits = floor($diff / $unit);
+ return $numberOfUnits . ' ' . $text . (($numberOfUnits > 1) ? 's' : '') . ' ago';
+ }
+ return 'just now';
+}
+
function detectType($data) {
if (strlen($data) < 25) return 'blob';
$repoGit->history('HEAD', 1, function($commit) {
- echo '<p style="margin-top: 8px; color: #58a6ff;">' . substr($commit->sha, 0, 7) . ' - ' . htmlspecialchars(substr(explode("\n", $commit->message)[0], 0, 50)) . '</p>';
+ // CHANGED: Display relative time instead of SHA/Message
+ echo '<p style="margin-top: 8px; color: #58a6ff;">' . time_elapsed_string($commit->date) . '</p>';
});