Skip to content

Commit b11eb12

Browse files
committed
Fix modified time. Use snprintf for uint64_t printing.
1 parent babd4ee commit b11eb12

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

supervisor/shared/web_workflow/web_workflow.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,11 @@ static void _reply_directory_json(socketpool_socket_obj_t *socket, _request *req
608608
(file_info.ftime >> 5) & 0x1f,
609609
(file_info.ftime & 0x1f) * 2) * 1000000000ULL;
610610

611-
mp_printf(&_socket_print, "\"modified_ns\": %lld, ", truncated_time);
611+
// Use snprintf because mp_printf doesn't support 64 bit numbers by
612+
// default.
613+
char encoded_time[32];
614+
snprintf(encoded_time, sizeof(encoded_time), "%llu", truncated_time);
615+
mp_printf(&_socket_print, "\"modified_ns\": %s, ", encoded_time);
612616
size_t file_size = 0;
613617
if ((file_info.fattrib & AM_DIR) == 0) {
614618
file_size = file_info.fsize;

0 commit comments

Comments
 (0)