Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usr.bin/lastcomm: fix timestamp display #802

Closed
wants to merge 1 commit into from

Conversation

paepckehh
Copy link
Contributor

usr.bin/lastcomm: fix timestamp display

Adjust the lastcomm command to output timestamps with a precision of seconds.

Reported by: Dr. Andreas Longwitz
Sponsored by: DSS Gmbh

usr.bin/lastcomm: fix timestamp display 

Adjust the lastcomm command to output timestamps with a precision of seconds.

Reported by: Dr. Andreas Longwitz 
Sponsored by: DSS Gmbh
Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

can you show us an example output?
does the man page need fixing?

@paepckehh
Copy link
Contributor Author

BEFORE:

[mpaepcke@dsspkg] /home/mpaepcke ./lastcomm -E -f /var/account/acct | head 
ps               -       root                             __       Tue Aug  1 14:23
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23
lastcomm         -X      mpaepcke                         pts/1    Tue Aug  1 14:23
head             -       mpaepcke                         pts/1    Tue Aug  1 14:23
ps               -       root                             __       Tue Aug  1 14:23
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23
lastcomm         -X      mpaepcke                         pts/1    Tue Aug  1 14:23
head             -       mpaepcke                         pts/1    Tue Aug  1 14:23
ps               -       root                             __       Tue Aug  1 14:23
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23

AFTER (a slightly more useful output):

[mpaepcke@dsspkg] /home/mpaepcke lastcomm -E -f /var/account/acct | head   
ps               -       root                             __       Tue Aug  1 14:23:25
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23:25
lastcomm         -X      mpaepcke                         pts/1    Tue Aug  1 14:23:20
head             -       mpaepcke                         pts/1    Tue Aug  1 14:23:20
ps               -       root                             __       Tue Aug  1 14:23:20
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23:20
ps               -       root                             __       Tue Aug  1 14:23:15
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23:15
ps               -       root                             __       Tue Aug  1 14:23:10
PassengerAgent   -FX     root                             __       Tue Aug  1 14:23:10

The man page currently doesn't offer detailed information about output time precision, nor does it present any time-stamped examples.

It's not a significant commit, but it can be quite bothersome if accounting is your final option for forensics. The information is available, so make use of it.

@emaste
Copy link
Member

emaste commented Sep 19, 2023

This might be more "improve" than "fix" the timestamp display. Also the commit title appears to be repeated in the commit.

    usr.bin/lastcomm: fix timestamp display
    
    usr.bin/lastcomm: fix timestamp display
    
    Adjust the lastcomm command to output timestamps with a precision of seconds.

It looks like .16s dates to the original 4.4 Lite sources in 9b50d90.

I agree for lastcomm that including seconds seems quite reasonable. I note that last(1) shows hours and minutes, e.g.:

...
emaste     pts/1    :0                     Wed Sep  6 20:53 - crash (1+16:27)
emaste     pts/0    :0                     Wed Sep  6 20:53 - crash (1+16:27)
emaste     pts/2    :0                     Wed Sep  6 19:19 - 20:53  (01:33)
emaste     pts/1    :0                     Wed Sep  6 15:44 - 20:53  (05:09)
...

which might be acceptable for reporting session start/end.

@emaste emaste added the merged label Sep 22, 2023
@emaste
Copy link
Member

emaste commented Sep 22, 2023

Merged in 6f4ce7e

@emaste emaste closed this Sep 22, 2023
freebsd-git pushed a commit that referenced this pull request Sep 22, 2023
Adjust the lastcomm command to output timestamps with a precision of
seconds.

Reported by:	Dr. Andreas Longwitz
Reviewed by:	emaste
Relnotes:	Yes
Sponsored by:	DSS Gmbh
Pull Request:	#802
emaste pushed a commit to emaste/freebsd that referenced this pull request Jan 6, 2024
Adjust the lastcomm command to output timestamps with a precision of
seconds.

Reported by:	Dr. Andreas Longwitz
Reviewed by:	emaste
Relnotes:	Yes
Sponsored by:	DSS Gmbh
Pull Request:	freebsd#802

(cherry picked from commit 6f4ce7e)
freebsd-git pushed a commit that referenced this pull request Jan 7, 2024
Adjust the lastcomm command to output timestamps with a precision of
seconds.

Reported by:	Dr. Andreas Longwitz
Reviewed by:	emaste
Relnotes:	Yes
Sponsored by:	DSS Gmbh
Pull Request:	#802

(cherry picked from commit 6f4ce7e)
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Feb 3, 2024
Adjust the lastcomm command to output timestamps with a precision of
seconds.

Reported by:	Dr. Andreas Longwitz
Reviewed by:	emaste
Relnotes:	Yes
Sponsored by:	DSS Gmbh
Pull Request:	freebsd/freebsd-src#802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants