KRB5_TIMEOFDAY(3)

πŸ“¦
version 7.8.0 Β· 2 versions
  • 7.8.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 14.5 Β· freebsd 14.5
, in alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– KRB5_TIMEOFDAY πŸ’–

okay bestie, so this is a page from the Library Functions Manual β€” section 3 of the Kerberos 5 docs, and it's literally all about how Kerberos handles time ⏰✨ (which, iykyk, is the whole entire plot of Kerberos, because if your clock is wrong nothing works, no cap).


🌸 NAME 🌸

krb5_timeofday, krb5_set_real_time, krb5_us_timeofday, krb5_format_time, krb5_string_to_deltat β€” the Kerberos 5 time handling functions πŸŽ€


πŸ“š LIBRARY πŸ“š

Kerberos 5 Library β€” link it with libkrb5, -lkrb5 🫢


✨ SYNOPSIS ✨

#include <krb5.h>

krb5_timestamp;

krb5_deltat;

krb5_error_code
krb5_set_real_time(krb5_context context, krb5_timestamp sec,
    int32_t usec);

krb5_error_code
krb5_timeofday(krb5_context context, krb5_timestamp *timeret);

krb5_error_code
krb5_us_timeofday(krb5_context context, krb5_timestamp *sec,
    int32_t *usec);

krb5_error_code
krb5_format_time(krb5_context context, time_t t, char *s, size_t len,
    krb5_boolean include_time);

krb5_error_code
krb5_string_to_deltat(const char *string, krb5_deltat *deltat);

πŸ’… DESCRIPTION πŸ’…

the vibe: time sync is the moment πŸ•°οΈ

krb5_set_real_time sets the absolute time that the caller knows the KDC has. the way that this works is β€” once you've told it, the Kerberos library can figure out the relative difference between the KDC's time and your local system's time, and it stores that difference right there in the context. and with that info? the library can adjust all the time stamps in Kerberos packages. slay. πŸ‘‘

krb5_timeofday() returns the current time β€” but adjusted with that time difference between the local host and the KDC, bestie. it's giving trust issues with your own clock. and krb5_us_timeofday() does the exact same thing but also hands you the microseconds πŸ¦‹

krb5_format_time formats the time t into the string s of length len. and if include_time is set, the time is set include_time. πŸ’€ yeah, that's genuinely what the original says, so that's what you get β€” no notes.

krb5_string_to_deltat parses a delta time string into deltat. periodt. ✨


πŸ”₯ SEE ALSO πŸ”₯


ngl if any of this is confusing it's because time itself is confusing and that's not on you 🫢

and that's the whole page, bestie!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

this was written by HEIMDAL and it's dated September 16, 2006 β€” yes it's older than most of the group chat but it still ate, and this is the KRB5_TIMEOFDAY(3) page signing off πŸ’…πŸŒŸ

πŸ“¦ where this page comes from