Skip to content

Commit 3f64fd1

Browse files
committed
Add years, fix output
1 parent 70c6ea1 commit 3f64fd1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

enum4linux-ng.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2683,13 +2683,18 @@ def policy_to_human(self, low, high, lockout=False):
26832683
hours = dt.hour
26842684
time_diff = dt - datetime.fromtimestamp(0, tz=timezone.utc)
26852685
days = time_diff.days
2686+
years = dt.year - 1970
26862687
except:
26872688
return "invalid time"
26882689

26892690
if days > 1:
26902691
time += f"{days} days "
26912692
elif days == 1:
26922693
time += f"{days} day "
2694+
if years == 1:
2695+
time += f"({years} year) "
2696+
elif years > 1:
2697+
time += f"({years} years) "
26932698
if hours > 1:
26942699
time += f"{hours} hours "
26952700
elif hours == 1:
@@ -2698,7 +2703,7 @@ def policy_to_human(self, low, high, lockout=False):
26982703
time += f"{minutes} minutes"
26992704
elif minutes == 1:
27002705
time += f"{minutes} minute"
2701-
return time
2706+
return time.rstrip()
27022707

27032708
### Printer Enumeration
27042709

0 commit comments

Comments
 (0)