Skip to content

Commit 8ddc4da

Browse files
kernel: Deprecated RTC::get()
1 parent 099301d commit 8ddc4da

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

api/kernel/rtc.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class RTC
2828
using timestamp_t = int64_t;
2929

3030
/// returns a 64-bit unix timestamp of the current time
31-
static timestamp_t get();
32-
33-
static timestamp_t now()
34-
{ return get(); }
31+
static timestamp_t now();
3532

3633
/// start an auto-calibration process
3734
static void init();

src/kernel/rtc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ void RTC::init()
2828
});
2929
}
3030

31-
RTC::timestamp_t RTC::get()
31+
RTC::timestamp_t RTC::now()
3232
{
3333
auto ticks = hw::CPU::rdtsc() - current_ticks;
3434
auto diff = ticks / Hz(MHz(_CPUFreq_)).count();
35-
35+
3636
return current_time + diff;
3737
}

src/kernel/syscalls.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int wait(int* UNUSED(status)) {
149149
}
150150

151151
int gettimeofday(struct timeval* p, void*) {
152-
p->tv_sec = RTC::get();
152+
p->tv_sec = RTC::now();
153153
p->tv_usec = 0;
154154
return 0;
155155
}
@@ -212,7 +212,7 @@ void abort_ex(const char* why) {
212212
// Basic second-resolution implementation - using CMOS directly for now.
213213
int clock_gettime(clockid_t clk_id, struct timespec *tp){
214214
if (clk_id == CLOCK_REALTIME) {
215-
tp->tv_sec = RTC::get();
215+
tp->tv_sec = RTC::now();
216216
tp->tv_nsec = 0;
217217
return 0;
218218
}

0 commit comments

Comments
 (0)