This is the table from man 5 terminfo
.
Do NOT hardcode terminal escape sequences. Use tput with the cap-names from the table below to get the right code for your terminal.
(P) | indicates that padding may be specified |
This is the table from man 5 terminfo
.
Do NOT hardcode terminal escape sequences. Use tput with the cap-names from the table below to get the right code for your terminal.
(P) | indicates that padding may be specified |
def ago(elapsed): | |
o = [] | |
for unit, size in [("yr",365*24*60*60),("mo",30*24*60*60),("wk",7*24*60*60),("d",24*60*60),("hr",60*60),("min",60),("sec",1)]: | |
if size > elapsed: continue | |
total = int(elapsed / size) | |
elapsed = elapsed % size | |
o.append(str(total) + unit) |