aboutsummaryrefslogtreecommitdiff
path: root/src/time.c
diff options
context:
space:
mode:
authorChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-05-12 16:53:08 -0400
committerChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-05-12 16:53:08 -0400
commit2d2617b63706b8781418565330d23449701b3a71 (patch)
treed23b163114289f7a5d4bed749b916603f244319e /src/time.c
parentinvestigating... (diff)
big updates
ok I figured out what the problem was, I think? put is nice too now, no more conversions eh also offsets are nice, makes iterating way easier
Diffstat (limited to 'src/time.c')
-rw-r--r--src/time.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/time.c b/src/time.c
index 64096c7..2993030 100644
--- a/src/time.c
+++ b/src/time.c
@@ -6,7 +6,6 @@
static JanetMethod jd_time_methods[] = {
{"gmtime", jd_gmtime},
{"localtime", jd_localtime},
- {"todict", jd_dict_time},
{NULL, NULL},
};
@@ -25,8 +24,9 @@ static int jd_time_get(void *p, Janet key, Janet *out) {
}
// time_t is always a UTC-representation
+// we hard-code the offset because of a macOS bug
static void jd_time_tostring(void *p, JanetBuffer *buffer) {
- strftime_buffer("%F %T.000 UTC", localtime(p), buffer);
+ strftime_buffer("%F %T.000 +0000", gmtime(p), buffer);
}
static const JanetAbstractType jd_time_t = {
@@ -50,15 +50,6 @@ time_t *jd_maketime(void) {
return janet_abstract(&jd_time_t, sizeof(time_t));
}
-JANET_FN(jd_dict_time,
- "(dict->time {...})",
- "") {
- janet_fixarity(argc, 1);
- JanetDictView dict = janet_getdictionary(argv, 0);
- struct tm *tm = jd_tm_from_dict(dict);
- return janet_wrap_abstract(tm);
-}
-
JANET_FN(jd_gmtime,
"(gmtime (time))",
"") {
@@ -92,7 +83,6 @@ JANET_FN(jd_time,
}
const JanetRegExt jd_time_cfuns[] = {
- JANET_REG("dict->time", jd_dict_time),
JANET_REG("gmtime", jd_gmtime),
JANET_REG("localtime", jd_localtime),
JANET_REG("time", jd_time),