diff --git a/src/lib/co/src/co_time.c b/src/lib/co/src/co_time.c index 28b859d..252ed34 100644 --- a/src/lib/co/src/co_time.c +++ b/src/lib/co/src/co_time.c @@ -693,7 +693,11 @@ time_TmToAscii ( } else if (format == time_eFormat_NumDateAndTime) { strftime(buf, bufsize, "%Y-%m-%d %H:%M:%S", tmptr); } else { - strftime(buf, bufsize, "%H:%M:%S", tmptr); + char fmtstr[32]; + + strncpy(fmtstr, buf, sizeof(fmtstr)); + fmtstr[31] = NULL; + strftime(buf, bufsize, fmtstr, tmptr); } return TIME__SUCCESS; diff --git a/src/lib/rt/src/rt_gdh.c b/src/lib/rt/src/rt_gdh.c index 70f0c8a..387606d 100644 --- a/src/lib/rt/src/rt_gdh.c +++ b/src/lib/rt/src/rt_gdh.c @@ -4691,9 +4691,10 @@ pwr_tStatus gdh_AttrValueToString( timstr, sizeof(timstr)); } } - else - sts = time_AtoAscii( (pwr_tTime *) value_ptr, time_eFormat_DateAndTime, - timstr, sizeof(timstr)); + else { + strcpy( timstr, format); + sts = time_AtoAscii( (pwr_tTime *) value_ptr, -1, timstr, sizeof(timstr)); + } if ( EVEN(sts)) strcpy( timstr, "-"); *len = sprintf( str, "%s", timstr);