]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: format the min/max timestamps in "systemd" style
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 13 Oct 2025 15:35:02 +0000 (17:35 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 13 Oct 2025 15:35:02 +0000 (17:35 +0200)
Before:
  Next elapse timestamp should be Sun Oct 12 00:10:00 UTC 2025 <= Sun 2025-10-12 05:43:04 UTC <= Sun Oct 12 22:10:00 UTC

After:
  Next elapse timestamp should be Tue 2025-10-14 00:10:00 CEST <= Tue 2025-10-14 19:39:11 CEST <= Tue 2025-10-14 22:10:00 CEST

test/units/TEST-53-TIMER.RandomizedDelaySec-reload.sh

index 08f4f469d647f9ecdbf35c9ad9b2a77e5aa258e7..eede7ae7c597cba51c1c50ba967b6bffded9f6e0 100755 (executable)
@@ -15,11 +15,11 @@ set -o pipefail
 . "$(dirname "$0")"/util.sh
 
 UNIT_NAME="timer-RandomizedDelaySec-$RANDOM"
-TARGET_TS="$(date --date="tomorrow 00:10")"
+TARGET_TS="$(date --date="tomorrow 00:10" "+%a %Y-%m-%d %H:%M:%S %Z")"
 TARGET_TS_S="$(date --date="$TARGET_TS" "+%s")"
 # Maximum possible next elapse timestamp: $TARGET_TS (OnCalendar=) + 22 hours (RandomizedDelaySec=)
 MAX_NEXT_ELAPSE_REALTIME_S="$((TARGET_TS_S + 22 * 60 * 60))"
-MAX_NEXT_ELAPSE_REALTIME="$(date --date="@$MAX_NEXT_ELAPSE_REALTIME_S")"
+MAX_NEXT_ELAPSE_REALTIME="$(date --date="@$MAX_NEXT_ELAPSE_REALTIME_S" "+%a %Y-%m-%d %H:%M:%S %Z")"
 
 # Let's make sure to return the date & time back to the original state once we're done with our time
 # shenigans. One way to do this would be to use hwclock, but the RTC in VMs can be unreliable or slow to