@@ -69,20 +69,25 @@ bool format_param_datetime(const s_param_datetime *param, const char *name) {
69
69
s_parsed_value_collection collec = {0 };
70
70
char * buf = strings .tmp .tmp ;
71
71
size_t buf_size = sizeof (strings .tmp .tmp );
72
- uint8_t time_buf [sizeof (uint32_t )] = {0 };
72
+ uint8_t time_buf [sizeof (time_t )] = {0 };
73
73
time_t timestamp ;
74
74
uint256_t block_height ;
75
75
76
76
if ((ret = value_get (& param -> value , & collec ))) {
77
77
for (int i = 0 ; i < collec .size ; ++ i ) {
78
78
if (param -> type == DT_UNIX ) {
79
- buf_shrink_expand (collec .value [i ].ptr ,
80
- collec .value [i ].length ,
81
- time_buf ,
82
- sizeof (time_buf ));
83
- timestamp = read_u32_be (time_buf , 0 );
84
- if (!(ret = time_format_to_utc (& timestamp , buf , buf_size ))) {
85
- break ;
79
+ if ((collec .value [i ].length >= param -> value .type_size ) &&
80
+ ismaxint ((uint8_t * ) collec .value [i ].ptr , collec .value [i ].length )) {
81
+ snprintf (buf , buf_size , "Unlimited" );
82
+ } else {
83
+ buf_shrink_expand (collec .value [i ].ptr ,
84
+ collec .value [i ].length ,
85
+ time_buf ,
86
+ sizeof (time_buf ));
87
+ timestamp = read_u64_be (time_buf , 0 );
88
+ if (!(ret = time_format_to_utc (& timestamp , buf , buf_size ))) {
89
+ break ;
90
+ }
86
91
}
87
92
} else if (param -> type == DT_BLOCKHEIGHT ) {
88
93
convertUint256BE (collec .value [i ].ptr , collec .value [i ].length , & block_height );
0 commit comments