typedef struct rlm_date_t {
char const *xlat_name;
char const *fmt;
+ bool utc;
} rlm_date_t;
static const CONF_PARSER module_config[] = {
{ "format", FR_CONF_OFFSET(PW_TYPE_STRING, rlm_date_t, fmt), "%b %e %Y %H:%M:%S %Z" },
+ { "utc", FR_CONF_OFFSET(PW_TYPE_BOOLEAN, rlm_date_t, utc), "no" },
CONF_PARSER_TERMINATOR
};
date = (time_t) vp->vp_integer;
encode:
- if (localtime_r(&date, &tminfo) == NULL) {
- REDEBUG("Failed converting time string to localtime");
- goto error;
+ if (!inst->utc) {
+ if (localtime_r(&date, &tminfo) == NULL) {
+ REDEBUG("Failed converting time string to localtime");
+ goto error;
+ }
+ } else {
+ if (gmtime_r(&date, &tminfo) == NULL) {
+ REDEBUG("Failed converting time string to gmtime");
+ goto error;
+ }
}
return strftime(out, outlen, inst->fmt, &tminfo);