+ /**
+ * Formats the given number of seconds into a more easily readable string.
+ *
+ * @param seconds
+ * The number of seconds
+ * @return The formatted time, or “unknown” if the time is unknown
+ */
+ static String t(Optional<Long> seconds) {
+ if (!seconds.isPresent()) {
+ return "unknown";
+ }
+ if (seconds.get() > 3600) {
+ return String.format("%02d:%02d:%02d", seconds.get() / 3600, (seconds.get() / 60) % 60, seconds.get() % 60);
+ }
+ return String.format("%02d:%02d", (seconds.get() / 60) % 60, seconds.get() % 60);
+ }
+