summaryrefslogtreecommitdiff
path: root/Kernel/RTC.cpp
AgeCommit message (Collapse)Author
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-03-12Kernel: Convert klog() => AK::Format in a handful of placesAndreas Kling
2021-02-11Kernel: Don't assert if RTC believes we're in the pastJean-Baptiste Boric
2020-08-26Kernel: Minor tweak to now() computationNico Weber
Make sure the expression is evaluated as time_t so that it does the right thing after 2037, and factor things so that the constants look less magical.
2020-08-26AK+LibCore+Kernel: Have fewer implementations of day_of_yearNico Weber
The JS tests pointed out that the implementation in DateTime had an off-by-one in the month when doing the leap year check, so this change fixes that bug.
2020-08-26AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epochNico Weber
I believe the implementation in RTC.cpp had an off-by-one in the year passed to is_leap_year(). If that's true, then this fixes that too.
2020-08-26AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_yearNico Weber
2020-08-21Kernel: Fix reading RTCNico Weber
The CMOS sets bit 2 (0x4) if times are binary, if it's not set they're in BCD. The CMOS sets bit 1 (0x1) if hours are on a 12 hour clock. In that case, the highest bit in the hour byte is set for PM times (both in binary and BCD times). Three bugs: 1. The lower 7 bits were masked off incorrectly when calling bcd_to_binary(). Use 0x7F as mask, not 0x70. 2. The highest bit to check if a time was PM was checked after BCD conversion of the low 7 bits, which clobbered that bit. Do the check before BCD conversion. 3. In the 12 hour clock, midnight and noon are "12", so those need to be converted to 0 even if for non-PM times (else midnight is "12", not "0"). With this, SerenityOS consistently shows UTC as the current time, as it should. If folks want it to display local time instead, they can get this by adding `-rtc base=localtime` to Meta/run.sh -- but a better fix would be to add timezone management and convert from UTC system clock to the user timezone at display time.
2020-08-20Kernel: Log time in addition to date in RTC startupNico Weber
2020-08-12Kernel: Mark compilation-unit-only functions as staticBen Wiederhake
This enables a nice warning in case a function becomes dead code. Also, in case of signal_trampoline_dummy, marking it external (non-static) prevents it from being 'optimized away', which would lead to surprising and weird linker errors. I found these places by using -Wmissing-declarations. The Kernel still shows these issues, which I think are false-positives, but don't want to touch: - Kernel/Arch/i386/CPU.cpp:1081:17: void Kernel::enter_thread_context(Kernel::Thread*, Kernel::Thread*) - Kernel/Arch/i386/CPU.cpp:1170:17: void Kernel::context_first_init(Kernel::Thread*, Kernel::Thread*, Kernel::TrapFrame*) - Kernel/Arch/i386/CPU.cpp:1304:16: u32 Kernel::do_init_context(Kernel::Thread*, u32) - Kernel/Arch/i386/CPU.cpp:1347:17: void Kernel::pre_init_finished() - Kernel/Arch/i386/CPU.cpp:1360:17: void Kernel::post_init_finished() No idea, not gonna touch it. - Kernel/init.cpp:104:30: void Kernel::init() - Kernel/init.cpp:167:30: void Kernel::init_ap(u32, Kernel::Processor*) - Kernel/init.cpp:184:17: void Kernel::init_finished(u32) Called by boot.S. - Kernel/init.cpp:383:16: int Kernel::__cxa_atexit(void (*)(void*), void*, void*) - Kernel/StdLib.cpp:285:19: void __cxa_pure_virtual() - Kernel/StdLib.cpp:300:19: void __stack_chk_fail() - Kernel/StdLib.cpp:305:19: void __stack_chk_fail_local() Not sure how to tell the compiler that the compiler is already using them. Also, maybe __cxa_atexit should go into StdLib.cpp? - Kernel/Modules/TestModule.cpp:31:17: void module_init() - Kernel/Modules/TestModule.cpp:40:17: void module_fini() Could maybe go into a new header. This would also provide type-checking for new modules.
2020-04-08Kernel: Fix awkward RTC log message at bootAndreas Kling
2020-03-02Kernel: Use klog() instead of kprintf()Liav A
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-09-28Kernel: Fix BIOS date/time on hardwareConrad Pankoff
It turns out some BIOS vendors don't support non-BCD date/time mode, but we were relying on it being available. We no longer do this, but instead check whether the BIOS claims to provide BCD or regular binary values for its date/time data.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-07Kernel: Qualify a bunch of #include statements.Andreas Kling
2019-06-07Kernel: Run clang-format on everything.Andreas Kling
2019-05-17Kernel/RTC: Mark some intentional fallthroughs to suppress compiler warningsRobin Burchell
2019-05-04Kernel: Computing the boot timestamp was a bit broken.Andreas Kling
2019-02-19Kernel: Fix wrong calculation of current Unix timestamp.Andreas Kling
2019-02-13WindowServer: Put a clock in the top right corner of the screen.Andreas Kling
This way we don't even need the Clock app anymore. Very cool :^)
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2018-10-31Add assertion that RTC year is >= 2018.Andreas Kling
2018-10-25Add gettimeofday() syscall and LibC wrappers gettimeofday() and time().Andreas Kling
This only has second accuracy right now, I'll work out subseconds later.