commit 654e171
default
·
2023-05-29 07:07:27 +0000 UTC
parent e913d03
New macro ISO_DATE_SPEC.
6 files changed,
+9,
-7
+3,
-3
1@@ -498,7 +498,7 @@ xs_dict *msg_base(snac *snac, const char *type, const char *id,
2
3 /* generated values */
4 if (date && strcmp(date, "@now") == 0) {
5- published = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
6+ published = xs_str_utctime(0, ISO_DATE_SPEC);
7 date = published;
8 }
9
10@@ -959,7 +959,7 @@ xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int
11
12 /* set the end time */
13 time_t t = time(NULL) + end_secs;
14- xs *et = xs_str_utctime(t, "%Y-%m-%dT%H:%M:%SZ");
15+ xs *et = xs_str_utctime(t, ISO_DATE_SPEC);
16
17 msg = xs_dict_append(msg, "endTime", et);
18
19@@ -1234,7 +1234,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
20
21 if (xs_is_null(xs_dict_get(f_msg, "published"))) {
22 /* add a date if it doesn't include one (Mastodon) */
23- xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
24+ xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
25 f_msg = xs_dict_set(f_msg, "published", date);
26 }
27
M
data.c
+1,
-1
1@@ -1688,7 +1688,7 @@ void notify_add(snac *snac, const char *type, const char *utype,
2 {
3 xs *ntid = tid(0);
4 xs *fn = xs_fmt("%s/notify/", snac->basedir);
5- xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
6+ xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
7 FILE *f;
8
9 /* create the directory */
M
html.c
+1,
-1
1@@ -1756,7 +1756,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
2 }
3
4 /* set the updated field */
5- xs *updated = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
6+ xs *updated = xs_str_utctime(0, ISO_DATE_SPEC);
7 msg = xs_dict_set(msg, "updated", updated);
8
9 /* overwrite object, not updating the indexes */
+1,
-1
1@@ -524,7 +524,7 @@ xs_dict *mastoapi_account(const xs_dict *actor)
2 acct = xs_dict_append(acct, "created_at", pub);
3 else {
4 /* unset created_at crashes Tusky, so lie like a mf */
5- xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
6+ xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
7 acct = xs_dict_append(acct, "created_at", date);
8 }
9
M
snac.h
+2,
-0
1@@ -9,6 +9,8 @@
2
3 #define DIR_PERM 02770
4
5+#define ISO_DATE_SPEC "%Y-%m-%dT%H:%M:%SZ"
6+
7 extern double disk_layout;
8 extern d_char *srv_basedir;
9 extern d_char *srv_config;
M
utils.c
+1,
-1
1@@ -218,7 +218,7 @@ int adduser(const char *uid)
2 {
3 snac snac;
4 xs *config = xs_dict_new();
5- xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
6+ xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
7 xs *pwd = NULL;
8 xs *pwd_f = NULL;
9 xs *key = NULL;