diff --git a/bench/benchctxswitch.c b/bench/benchctxswitch.c index 9820a269..c217edd1 100644 --- a/bench/benchctxswitch.c +++ b/bench/benchctxswitch.c @@ -29,7 +29,7 @@ static int uptime(uintmax_t* usecs) { struct timespec uptime; - if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 ) + if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 ) return -1; *usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL; return 0; diff --git a/bench/benchsyscall.c b/bench/benchsyscall.c index f9b040e4..1239fc17 100644 --- a/bench/benchsyscall.c +++ b/bench/benchsyscall.c @@ -25,7 +25,7 @@ static int uptime(uintmax_t* usecs) { struct timespec uptime; - if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 ) + if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 ) return -1; *usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL; return 0; diff --git a/kernel/disk/ahci/ahci.cpp b/kernel/disk/ahci/ahci.cpp index da52c433..218fa162 100644 --- a/kernel/disk/ahci/ahci.cpp +++ b/kernel/disk/ahci/ahci.cpp @@ -43,7 +43,7 @@ bool WaitClear(volatile little_uint32_t* reg, unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) @@ -68,7 +68,7 @@ bool WaitSet(volatile little_uint32_t* reg, unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) diff --git a/kernel/disk/ahci/port.cpp b/kernel/disk/ahci/port.cpp index 3a294bbf..aa6a20ef 100644 --- a/kernel/disk/ahci/port.cpp +++ b/kernel/disk/ahci/port.cpp @@ -56,7 +56,7 @@ static inline void delay(unsigned int usecs) { struct timespec delay = timespec_make(usecs / 1000000, (usecs % 1000000) * 1000); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); clock->SleepDelay(delay); } @@ -668,7 +668,7 @@ void Port::PrepareAwaitInterrupt() bool Port::AwaitInterrupt(unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) diff --git a/kernel/disk/ata/hba.cpp b/kernel/disk/ata/hba.cpp index 0cb52a76..fca68ea3 100644 --- a/kernel/disk/ata/hba.cpp +++ b/kernel/disk/ata/hba.cpp @@ -52,7 +52,7 @@ static unsigned long AllocateDiskNumber() static void sleep_400_nanoseconds() { struct timespec delay = timespec_make(0, 400); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); clock->SleepDelay(delay); } diff --git a/kernel/disk/ata/port.cpp b/kernel/disk/ata/port.cpp index 3d825062..3f414b21 100644 --- a/kernel/disk/ata/port.cpp +++ b/kernel/disk/ata/port.cpp @@ -59,7 +59,7 @@ static void copy_ata_string(char* dest, const char* src, size_t length) static void sleep_400_nanoseconds() { struct timespec delay = timespec_make(0, 400); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); clock->SleepDelay(delay); } @@ -860,7 +860,7 @@ void Port::PrepareAwaitInterrupt() bool Port::AwaitInterrupt(unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) diff --git a/kernel/include/sortix/clock.h b/kernel/include/sortix/clock.h index 01444eb4..4be23342 100644 --- a/kernel/include/sortix/clock.h +++ b/kernel/include/sortix/clock.h @@ -28,7 +28,7 @@ extern "C" { #define CLOCK_REALTIME 0 /* Current real time. */ #define CLOCK_MONOTONIC 1 /* Always increasing time. */ -#define CLOCK_BOOT 2 /* Time since system boot (uptime). */ +#define CLOCK_BOOTTIME 2 /* Time since system boot (uptime). */ #define CLOCK_INIT 3 /* Time since 'init' process began. */ #define CLOCK_PROCESS_CPUTIME_ID 4 #define CLOCK_PROCESS_SYSTIME_ID 5 diff --git a/kernel/time.cpp b/kernel/time.cpp index 803a8974..5c01fb68 100644 --- a/kernel/time.cpp +++ b/kernel/time.cpp @@ -48,7 +48,7 @@ Clock* GetClock(clockid_t clock) switch ( clock ) { case CLOCK_REALTIME: return realtime_clock; - case CLOCK_BOOT: return uptime_clock; + case CLOCK_BOOTTIME: return uptime_clock; case CLOCK_INIT: return uptime_clock; case CLOCK_MONOTONIC: return uptime_clock; case CLOCK_PROCESS_CPUTIME_ID: return &CurrentProcess()->execute_clock; diff --git a/kernel/x86-family/ioport.cpp b/kernel/x86-family/ioport.cpp index 3e7dd80a..e639ac1e 100644 --- a/kernel/x86-family/ioport.cpp +++ b/kernel/x86-family/ioport.cpp @@ -31,7 +31,7 @@ namespace Sortix { bool wait_inport8_clear(uint16_t ioport, uint8_t bits, bool any, unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) @@ -53,7 +53,7 @@ bool wait_inport8_clear(uint16_t ioport, uint8_t bits, bool any, unsigned int ms bool wait_inport8_set(uint16_t ioport, uint8_t bits, bool any, unsigned int msecs) { struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L); - Clock* clock = Time::GetClock(CLOCK_BOOT); + Clock* clock = Time::GetClock(CLOCK_BOOTTIME); struct timespec begun; clock->Get(&begun, NULL); while ( true ) diff --git a/utils/uptime.c b/utils/uptime.c index c228d666..0f5f68cf 100644 --- a/utils/uptime.c +++ b/utils/uptime.c @@ -56,8 +56,8 @@ void PrintElement(size_t num, const char* single, const char* multiple) int main(void) { struct timespec uptime; - if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 ) - error(1, errno, "clock_gettime(CLOCK_BOOT)"); + if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 ) + error(1, errno, "clock_gettime(CLOCK_BOOTTIME)"); uintmax_t usecssinceboot = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL;