Skip to content

Commit 8ecea29

Browse files
authored
Merge pull request #3784 from zhiweih/patch-1
Specify date string length in FINSH date command.
2 parents fa599be + 814b646 commit 8ecea29

File tree

1 file changed

+2
-2
lines changed
  • components/drivers/rtc

1 file changed

+2
-2
lines changed

components/drivers/rtc/rtc.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void list_date(void)
179179
time_t now;
180180

181181
now = time(RT_NULL);
182-
rt_kprintf("%s\n", ctime(&now));
182+
rt_kprintf("%.*s\n", 25, ctime(&now));
183183
}
184184
FINSH_FUNCTION_EXPORT(list_date, show date and time.)
185185

@@ -194,7 +194,7 @@ static void date(uint8_t argc, char **argv)
194194
time_t now;
195195
/* output current time */
196196
now = time(RT_NULL);
197-
rt_kprintf("%s", ctime(&now));
197+
rt_kprintf("%.*s", 25, ctime(&now));
198198
}
199199
else if (argc >= 7)
200200
{

0 commit comments

Comments
 (0)