Epoch in Berry map for time

Uses mktime to calculate the epoch value from the broken-down time structure, could potentially be tuned if deemed too inefficient in case of the caller already having the epoch value nearby.
This commit is contained in:
sfromis
2022-10-09 16:09:29 +02:00
committed by GitHub
parent 789075ee6b
commit 409c9888dd
@@ -265,6 +265,7 @@ extern "C" {
be_map_insert_int(vm, "min", t->tm_min);
be_map_insert_int(vm, "sec", t->tm_sec);
be_map_insert_int(vm, "weekday", t->tm_wday);
be_map_insert_int(vm, "epoch", mktime(t));
if (unparsed) be_map_insert_str(vm, "unparsed", unparsed);
be_pop(vm, 1);
}