A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

time-sync: allow passing an arbitrary time.

During testing it can be useful to set an arbitrary (non-current) time on the
device. Extend time-sync to accept an additional (optional) parameter with the
time to set. Only changes date / time, no timezone.

Change-Id: Ib320777cb245cff19ca00b20540db3a43a4e488f

+19 -5
+19 -5
utils/time-sync/time-sync.c
··· 16 16 * 17 17 */ 18 18 19 + #define _XOPEN_SOURCE /* to enable strptime() */ 19 20 #include <stdlib.h> 20 21 #include <stdio.h> 21 22 #include <time.h> ··· 27 28 main (int argc, char **argv) 28 29 { 29 30 if (argc < 2) { 30 - printf ("usage: %s <device>\n", basename(argv[0])); 31 - return 1; 31 + printf ("usage: %s <device> [time]\n", basename(argv[0])); 32 + return 1; 32 33 } 33 34 34 - if (sync_time (argv[1], NULL)) { 35 - printf ("Error occured while syncing time.\n"); 35 + struct tm time; 36 + struct tm* ptime = NULL; 37 + if (argc > 2) { 38 + if(strptime(argv[2], "%Y-%m-%dT%H:%M:%S", &time)) { 39 + ptime = &time; 40 + } 41 + else { 42 + printf ("Could not parse time. Using local time.\n"); 43 + printf ("Time string needs to use the format YYYY-MM-DDThh:mm:ss\n"); 44 + printf ("(ISO 8601 format)\n"); 45 + } 46 + } 47 + 48 + if (sync_time (argv[1], ptime)) { 49 + printf ("Error occured while syncing time.\n"); 36 50 } else { 37 - printf ("Time was synced!\n"); 51 + printf ("Time was synced!\n"); 38 52 } 39 53 40 54 return 0;