@@ -192,6 +192,8 @@ typedef struct UnitStatusInfo {
192192 usec_t active_exit_timestamp ;
193193 usec_t inactive_enter_timestamp ;
194194
195+ uint64_t runtime_max_sec ;
196+
195197 bool need_daemon_reload ;
196198 bool transient ;
197199
@@ -419,11 +421,19 @@ static void print_status_info(
419421 STRPTR_IN_SET (i -> active_state , "activating" ) ? i -> inactive_exit_timestamp :
420422 i -> active_exit_timestamp ;
421423
422- if (timestamp > 0 && timestamp < USEC_INFINITY )
424+ if (timestamp > 0 && timestamp < USEC_INFINITY ) {
423425 printf (" since %s; %s\n" ,
424426 FORMAT_TIMESTAMP_STYLE (timestamp , arg_timestamp_style ),
425427 FORMAT_TIMESTAMP_RELATIVE (timestamp ));
426- else
428+ if (streq_ptr (i -> active_state , "active" ) && i -> runtime_max_sec < USEC_INFINITY ) {
429+ usec_t until_timestamp ;
430+
431+ until_timestamp = usec_add (timestamp , i -> runtime_max_sec );
432+ printf (" Until: %s; %s\n" ,
433+ FORMAT_TIMESTAMP_STYLE (until_timestamp , arg_timestamp_style ),
434+ FORMAT_TIMESTAMP_RELATIVE (until_timestamp ));
435+ }
436+ } else
427437 printf ("\n" );
428438
429439 STRV_FOREACH (t , i -> triggered_by ) {
@@ -1850,6 +1860,7 @@ static int show_one(
18501860 { "InactiveExitTimestampMonotonic" , "t" , NULL , offsetof(UnitStatusInfo , inactive_exit_timestamp_monotonic ) },
18511861 { "ActiveEnterTimestamp" , "t" , NULL , offsetof(UnitStatusInfo , active_enter_timestamp ) },
18521862 { "ActiveExitTimestamp" , "t" , NULL , offsetof(UnitStatusInfo , active_exit_timestamp ) },
1863+ { "RuntimeMaxUSec" , "t" , NULL , offsetof(UnitStatusInfo , runtime_max_sec ) },
18531864 { "InactiveEnterTimestamp" , "t" , NULL , offsetof(UnitStatusInfo , inactive_enter_timestamp ) },
18541865 { "NeedDaemonReload" , "b" , NULL , offsetof(UnitStatusInfo , need_daemon_reload ) },
18551866 { "Transient" , "b" , NULL , offsetof(UnitStatusInfo , transient ) },
0 commit comments