mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
Add assertion that RTC year is >= 2018.
This commit is contained in:
parent
555c10a1f8
commit
4dec23b487
Notes:
sideshowbarker
2024-07-19 18:36:09 +09:00
Author: https://github.com/awesomekling
Commit: 4dec23b487
1 changed files with 3 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "CMOS.h"
|
#include "CMOS.h"
|
||||||
|
#include <AK/Assertions.h>
|
||||||
|
|
||||||
namespace RTC {
|
namespace RTC {
|
||||||
|
|
||||||
|
@ -78,6 +79,8 @@ time_t now()
|
||||||
unsigned minute = CMOS::read(0x02);
|
unsigned minute = CMOS::read(0x02);
|
||||||
unsigned second = CMOS::read(0x00);
|
unsigned second = CMOS::read(0x00);
|
||||||
|
|
||||||
|
ASSERT(year >= 2018);
|
||||||
|
|
||||||
return daysInYearsSinceEpoch(year - 1) * 86400
|
return daysInYearsSinceEpoch(year - 1) * 86400
|
||||||
+ daysInMonthsSinceStartOfYear(month - 1, year) * 86400
|
+ daysInMonthsSinceStartOfYear(month - 1, year) * 86400
|
||||||
+ day * 86400
|
+ day * 86400
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue