From a09f506ff3ed6a47eb7b3cb045164defd6b8d198 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 12 Feb 2024 23:51:36 -0500 Subject: Add Delivery.info.time_str_epoch member to store Unix epoch as a string. --- src/deliverable.c | 6 ++++++ src/main.c | 1 + 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/deliverable.c b/src/deliverable.c index 6d868e0..72e4eff 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -277,6 +277,12 @@ int delivery_init(struct Delivery *ctx, struct INIFILE *ini, struct INIFILE *cfg // Record timestamp used for release time(&ctx->info.time_now); ctx->info.time_info = localtime(&ctx->info.time_now); + ctx->info.time_str_epoch = calloc(OMC_TIME_STR_MAX, sizeof(*ctx->info.time_str_epoch)); + if (!ctx->info.time_str_epoch) { + msg(OMC_MSG_ERROR, "Unable to allocate memory for Unix epoch string\n"); + return -1; + } + snprintf(ctx->info.time_str_epoch, OMC_TIME_STR_MAX - 1, "%li", ctx->info.time_now); if (cfg) { getter(cfg, "default", "conda_staging_dir", INIVAL_TYPE_STR) diff --git a/src/main.c b/src/main.c index c7ab362..2a0125d 100644 --- a/src/main.c +++ b/src/main.c @@ -199,6 +199,7 @@ int main(int argc, char *argv[], char *arge[]) { tpl_register("meta.mission", &ctx.meta.mission); tpl_register("meta.python", &ctx.meta.python); tpl_register("meta.python_compact", &ctx.meta.python_compact); + tpl_register("info.time_str_epoch", &ctx.info.time_str_epoch); tpl_register("info.release_name", &ctx.info.release_name); tpl_register("conda.installer_baseurl", &ctx.conda.installer_baseurl); tpl_register("conda.installer_name", &ctx.conda.installer_name); -- cgit