From 9ba6572ecbdaae147e6bfe67634867ef336a2ee0 Mon Sep 17 00:00:00 2001 From: Eduardo Fiss Beloni Date: Fri, 4 Apr 2014 08:08:55 -0300 Subject: [PATCH] src/lib/co/src/co_time: time and date format --- src/lib/co/src/co_time.c | 2 ++ src/lib/co/src/co_time.h | 3 ++- src/lib/rt/src/rt_gdh.c | 5 +++++ 3 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/lib/co/src/co_time.c b/src/lib/co/src/co_time.c index 28b859d..bd2a171 100644 --- a/src/lib/co/src/co_time.c +++ b/src/lib/co/src/co_time.c @@ -692,6 +692,8 @@ time_TmToAscii ( strftime(buf, bufsize, "%y-%m-%d %H:%M:%S", tmptr); } else if (format == time_eFormat_NumDateAndTime) { strftime(buf, bufsize, "%Y-%m-%d %H:%M:%S", tmptr); + } else if (format == time_eFormat_TimeAndDate) { + strftime(buf, bufsize, "%H:%M:%S %d/%m/%y", tmptr); } else { strftime(buf, bufsize, "%H:%M:%S", tmptr); } diff --git a/src/lib/co/src/co_time.h b/src/lib/co/src/co_time.h index b09b70b..b09c58c 100644 --- a/src/lib/co/src/co_time.h +++ b/src/lib/co/src/co_time.h @@ -89,7 +89,8 @@ typedef enum { time_eFormat_ComprDateAndTime = 2, //!< Date and time compressed format, 70-01-01 00:00:00 time_eFormat_NumDateAndTime = 3, //!< Date and time format, 2005-01-01 00:00:00 time_eFormat_FileDateAndTime = 4, //!< Date and time format, 20050101_000000 - time_eFormat_FileDate = 5 //!< Date format, 20050101 + time_eFormat_FileDate = 5, //!< Date format, 20050101 + time_eFormat_TimeAndDate = 6, //!< Time and date format, 01:00:00 30/01/87 } time_eFormat; typedef enum { diff --git a/src/lib/rt/src/rt_gdh.c b/src/lib/rt/src/rt_gdh.c index 70f0c8a..3d6f8be 100644 --- a/src/lib/rt/src/rt_gdh.c +++ b/src/lib/rt/src/rt_gdh.c @@ -4686,6 +4686,11 @@ pwr_tStatus gdh_AttrValueToString( timstr, sizeof(timstr)); timstr[8] = 0; break; + case '6': + // Format %6t, time before to date + sts = time_AtoAscii( (pwr_tTime *) value_ptr, time_eFormat_TimeAndDate, + timstr, sizeof(timstr)); + break; default: sts = time_AtoAscii( (pwr_tTime *) value_ptr, time_eFormat_DateAndTime, timstr, sizeof(timstr)); -- 1.7.4.1