@@ -69,20 +69,28 @@ bool format_param_datetime(const s_param_datetime *param, const char *name) {
6969 s_parsed_value_collection collec = {0 };
7070 char * buf = strings .tmp .tmp ;
7171 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 };
7373 time_t timestamp ;
74+ // the size of the largest integer
75+ uint8_t max_int_buf [INT256_LENGTH ];
7476 uint256_t block_height ;
7577
7678 if ((ret = value_get (& param -> value , & collec ))) {
7779 for (int i = 0 ; i < collec .size ; ++ i ) {
7880 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 ;
81+ memset (max_int_buf , 0xff , sizeof (max_int_buf ));
82+ if ((collec .value [i ].length >= param -> value .type_size ) &&
83+ (memcmp (collec .value [i ].ptr , max_int_buf , collec .value [i ].length ) == 0 )) {
84+ snprintf (buf , buf_size , "Unlimited" );
85+ } else {
86+ buf_shrink_expand (collec .value [i ].ptr ,
87+ collec .value [i ].length ,
88+ time_buf ,
89+ sizeof (time_buf ));
90+ timestamp = read_u64_be (time_buf , 0 );
91+ if (!(ret = time_format_to_utc (& timestamp , buf , buf_size ))) {
92+ break ;
93+ }
8694 }
8795 } else if (param -> type == DT_BLOCKHEIGHT ) {
8896 convertUint256BE (collec .value [i ].ptr , collec .value [i ].length , & block_height );
0 commit comments