1
0
Fork 0

clean up `time_ago()`

Co-authored-by: Doug Freed <dwfreed@mtu.edu>
This commit is contained in:
David Schultz 2023-03-27 19:37:48 -05:00 committed by GitHub
parent 201296a0da
commit ee12134812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -146,16 +146,12 @@ static char *time_ago(time_t seconds)
seconds = time(NULL) - seconds;
years = seconds/(86400*365);
seconds %= (86400*365);
weeks = seconds/604800;
seconds %= 604800;
days = seconds/86400;
seconds %= 86400;
hours = seconds/3600;
hours %= 3600;
minutes = seconds/60;
minutes %= 60;
years = seconds / (86400 * 365);
seconds %= (86400 * 365);
weeks = seconds / 604800;
days = (seconds / 86400) % 7;
hours = (seconds / 3600) % 24;
minutes = (seconds / 60) % 60;
seconds %= 60;
if (years)