Rename CLOCK_BOOT to CLOCK_BOOTTIME.

This commit is contained in:
auronandace 2022-02-10 18:49:36 +00:00 committed by Mathew John Roberts
parent d41beab4a8
commit 292aeb3fe7
10 changed files with 15 additions and 15 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 )

View File

@ -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 )

View File

@ -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);
}

View File

@ -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 )

View File

@ -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

View File

@ -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;

View File

@ -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 )

View File

@ -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;