Browse Source

[Improve][AW-CC][Module_LcmControl]
2022-03-01 / Eason Yang
Action
1. Improve : getDataTimeString() function improve. p.m. & a.m.

File
1. Module_LcmControl.c
Action 1

LCM VERSION: V0.27

8009 3 years ago
parent
commit
8d0baac789
1 changed files with 6 additions and 1 deletions
  1. 6 1
      EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c

+ 6 - 1
EVSE/Projects/AW-CCS/Apps/LCM/Module_LcmControl.c

@@ -300,7 +300,12 @@ void getDateTimeString(char* result)
 
 	tmTarget = gmtime(&tbTarget.time);
 	//sprintf(result, "%04d/%02d/%02d %02d:%02d", tm->tm_year+1900,tm->tm_mon+1,tm->tm_mday,tm->tm_hour,tm->tm_min);
-	sprintf(result, "%04d/%02d/%02d %02d:%02d %s", tmTarget->tm_year+1900,tmTarget->tm_mon+1,tmTarget->tm_mday,(tmTarget->tm_hour%12),tmTarget->tm_min,((tmTarget->tm_hour/12)>0?"p.m":"a.m"));
+	//sprintf(result, "%04d/%02d/%02d %02d:%02d %s", tmTarget->tm_year+1900,tmTarget->tm_mon+1,tmTarget->tm_mday,(tmTarget->tm_hour%12),tmTarget->tm_min,((tmTarget->tm_hour/12)>0?"p.m":"a.m"));
+	
+	if((tmTarget->tm_hour%12) == 0)
+		sprintf(result, "%04d/%02d/%02d %02d:%02d %s", tmTarget->tm_year+1900,tmTarget->tm_mon+1,tmTarget->tm_mday,((tmTarget->tm_hour%12)==0?12:(tmTarget->tm_hour%12)),tmTarget->tm_min,((tmTarget->tm_hour/12)==1?"p.m":"a.m"));
+	else
+		sprintf(result, "%04d/%02d/%02d %02d:%02d %s", tmTarget->tm_year+1900,tmTarget->tm_mon+1,tmTarget->tm_mday,(tmTarget->tm_hour%12),tmTarget->tm_min,((tmTarget->tm_hour/12)>0?"p.m":"a.m"));
 }
 
 //======================================================