diff options
author | June McEnroe <june@causal.agency> | 2021-01-27 14:18:20 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-27 14:18:20 -0500 |
commit | d6ff9e53cf724460b6f827edf40d698d35ffa2f7 (patch) | |
tree | f54e194740a4600a3ac6ea3966e58a76adf1f0fb /chat.c | |
parent | Add toggleable display of timestamps (diff) | |
download | catgirl-d6ff9e53cf724460b6f827edf40d698d35ffa2f7.tar.gz catgirl-d6ff9e53cf724460b6f827edf40d698d35ffa2f7.zip |
Change default timestamp format to %X
This respects the user's locale settings.
Diffstat (limited to '')
-rw-r--r-- | chat.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/chat.c b/chat.c index 7de427c..7335520 100644 --- a/chat.c +++ b/chat.c @@ -125,16 +125,6 @@ static void parseHash(char *str) { if (*str) hashBound = strtoul(&str[1], NULL, 0); } -static void parseTimestamp(const char *format) { - uiTime.enable = true; - if (!format) return; - char buf[TimeCap]; - uiTime.format = format; - struct tm *time = localtime(&(time_t) { -22100400 }); - uiTime.width = strftime(buf, sizeof(buf), format, time); - if (!uiTime.width) errx(EX_USAGE, "invalid timestamp format: %s", format); -} - #ifdef __OpenBSD__ static void unveilConfig(const char *name) { @@ -246,7 +236,10 @@ int main(int argc, char *argv[]) { break; case 'O': utilPush(&urlOpenUtil, optarg); break; case 'R': self.restricted = true; break; case 'S': bind = optarg; - break; case 'T': parseTimestamp(optarg); + break; case 'T': { + uiTime.enable = true; + if (optarg) uiTime.format = optarg; + } break; case 'a': sasl = true; self.plain = optarg; break; case 'c': cert = optarg; break; case 'e': sasl = true; |