+/* format_zone reads time zone information from "extern long timezone", exported
+ * by <time.h>, and formats it according to RFC 3339. This differs from
+ * strftime()'s "%z" format by including a colon between hour and minute. */
+static void format_zone (char *buffer, size_t buffer_size) /* {{{ */
+{
+ _Bool east = 0;
+ long hours;
+ long minutes;
+
+ minutes = timezone / 60;
+ if (minutes == 0) {
+ sstrncpy (buffer, "Z", buffer_size);
+ return;
+ }
+
+ if (minutes < 0)
+ {
+ east = 1;
+ minutes = minutes * (-1);
+ }
+
+ hours = minutes / 60;
+ minutes = minutes % 60;
+
+ ssnprintf (buffer, buffer_size, "%s%02ld:%02ld",
+ (east ? "+" : "-"), hours, minutes);
+} /* }}} int format_zone */
+
+static int format_rfc3339 (char *buffer, size_t buffer_size, cdtime_t t, _Bool print_nano) /* {{{ */