diff options
-rw-r--r-- | include/deliverable.h | 7 | ||||
-rw-r--r-- | include/omc.h | 1 | ||||
-rw-r--r-- | src/deliverable.c | 6 | ||||
-rw-r--r-- | src/main.c | 1 |
4 files changed, 12 insertions, 3 deletions
diff --git a/include/deliverable.h b/include/deliverable.h index d0186d7..ed9d12a 100644 --- a/include/deliverable.h +++ b/include/deliverable.h @@ -86,9 +86,10 @@ struct Delivery { * \brief Release information (name & datetime) */ struct Info { - char *release_name; ///< The fully combined release string - struct tm *time_info; - time_t time_now; ///< Time stamp for when OMC execution started + char *release_name; ///< The fully combined release string + struct tm *time_info; ///< Delivery time structure + time_t time_now; ///< Time stamp for when OMC execution started + char *time_str_epoch; ///< String representation of Unix epoch } info; /*! \struct Conda diff --git a/include/omc.h b/include/omc.h index 36ab676..21ffd0a 100644 --- a/include/omc.h +++ b/include/omc.h @@ -13,6 +13,7 @@ #define OMC_BUFSIZ 8192 #define OMC_NAME_MAX 255 #define OMC_DIRSTACK_MAX 1024 +#define OMC_TIME_STR_MAX 128 #define HTTP_ERROR(X) X >= 400 #include "config.h" 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) @@ -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); |