LL2_UPDATE_LOGIN_TIME(3)

πŸ’– LL2_UPDATE_LOGIN_TIME(3) πŸ’–

ok so bestie, we're in the lastlog2.h cinematic universe β€” this is the ll2_update_login_time page from the lastlog2 section 3 manual, and yes it's giving "tiny function, very important job" energy. let's get into it 🫢


✨ NAME ✨

ll2_update_login_time β€” writes a new entry with updated login time. yep that's the whole vibe, she updates and she writes πŸ”₯


✨ SYNOPSIS ✨

#include <lastlog2.h>

int ll2_update_login_time (struct ll2_context *context, const char
*user, int64_t ll_time, char **error);

✨ DESCRIPTION ✨

okay so what does she actually do? ll2_update_login_time writes a new entry to the database (the one defined in context), and that entry is for user. the time gets set by ll_time, and literally every other value is copied over from an entry that already exists. so she's not inventing a whole new person, she's just refreshing the timestamp on someone who's already in there. lowkey iconic πŸ’…

and if context is NULL? no stress β€” the default database, defined in LL2_DEFAULT_DATABASE, gets taken instead. main character fallback behaviour fr fr ✨

char    *error = NULL;
const   char *user = "root";
int64_t login_time = time(0); // Get the system time;

int ret = ll2_update_login_time (NULL, user, login_time, &error);

that's the whole call, bestie: "root", the current system time, NULL context so the default db gets used, and a lil error pointer ready to catch anything πŸ‘‘


✨ RETURN VALUE ✨

ok so the tea on what she hands back:

  • returns 0 on success πŸŽ‰
  • returns -ENOMEM or -1 on other failure 😭
  • error contains an error string if the return value is -1
  • but error is not guaranteed to contain an error string β€” it could also be NULL. do not come for her about it, that's just how it is πŸ™ˆ
  • error should be freed by the caller. yes you, bestie β€” that's your job, don't forget, memory leaks are not the vibe πŸ’€

✨ AUTHORS ✨

Thorsten Kukuk <kukuk@suse.de> β€” thank him pls, he wrote this 🌸


✨ SEE ALSO ✨

the whole lastlog2 friend group, go say hi:


✨ REPORTING BUGS ✨

found a bug? don't suffer in silence, bestie 😭 for bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues> β€” they'll sort you out 🫢


✨ AVAILABILITY ✨

the liblastlog2 library is part of the util-linux package since version 2.40. it can be downloaded from the Linux Kernel Archive at <https://www.kernel.org/pub/linux/utils/util-linux/> πŸ¦‹


and that's the page, babes πŸŽ€ this was util-linux 2.41.6, dated 2026-08-31, and she's LL2_UPDATE_LOGIN_TIME(3) β€” slay, go update those login times, ily, mwah πŸ’œβœ¨

πŸ“¦ where this page comes from