[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


previous: >>108613877

#define __NR_adjtimex                159
#define __NR_clock_adjtime 305

https://man7.org/linux/man-pages/man2/adjtimex.2.html

tl;dr:
clock algorithm wizardry

that's all you're getting for the description, too. it's just algorithm stuff. important, sure, but really complicated and outside of my area of expertise

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
>>
This is used to implement adjtime(3), which tries to change the time by slightly speeding up or slowing down the clock until the time is correct. This is meant to avoid confusing programs that use CLOCK_REALTIME because the clock jumped a huge amount of time in an instant. https://man7.org/linux/man-pages/man3/adjtime.3.html
>>
>>108623490
Actually I guess its not just programs that use CLOCK_REALTIME, but also programs like make that care about file timestamps
>>
I guess this is the thread to ask this in: does anyone know what the deal with leap seconds is? I know Unix time is supposed to ignore them, so is Unix time 22 seconds (or however much) off from real time or what? I've implemented my own C time library because the stdlib one sucks, and the results from that are identical to coreutils tools, which are identical to what the NIST atomic clock calculates, so where do the leap seconds factor in?
>>
Bumped just in time.
>>
>>108625104
yay
>>
I guess nobody cares about this one. Or maybe it's just Friday.
>>
>>108626677
I'm busy sperging out at retarded compiler devs.
>>
>>108623903
unix timestamp is miserable underspecified in this sense.
time(NULL) and clock_gettime(CLOCK_REALTIME) already returns time modified by leap seconds. this is Linux behavior, some systems might behave differently. it's just not specified.
the fucked up thing is that during leap second, you just get the same time for window of two seconds. although the nice side effect is that the conversion from seconds to calendar is always correct (but for leap seconds you have two possible answers, you always get the 59s instead of 60s).
conversion to struct tm with GM timezone is just formatting, doesn't care about leap seconds being or not being included.
there is a file in /etc with leap seconds, any program that cares needs to process it on its own.

actually I'm not sure how OS handles the addition of leap seconds. I think you have to update the table file (some OS core package, maybe main distro release) and reboot??? does Linux kernel accesses this file? how and when? idk

god I fucking have leap seconds and UTC so fucking much. If I had a time machine I would kill that faggot who used it as time base for NTP.
>>
>>108628953
>clock_gettime(CLOCK_REALTIME) already returns time modified by leap seconds
I guess that explains it. Thanks.

>god I fucking [hate] leap seconds and UTC so fucking much
Same.
>>
>>108628953
>actually I'm not sure how OS handles the addition of leap seconds. I think you have to update the table file (some OS core package, maybe main distro release) and reboot??? does Linux kernel accesses this file? how and when?
to answer my own question: userspace NTP server handles this, kernel doesnt care. and usually NTP server handles it for clients. NTP signals ongoing leap second, but doesnt actually distribute the full table itself nor offset from TAI.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.