Rename CLOCK_BOOT to CLOCK_BOOTTIME.
This commit is contained in:
parent
d41beab4a8
commit
292aeb3fe7
|
@ -29,7 +29,7 @@
|
||||||
static int uptime(uintmax_t* usecs)
|
static int uptime(uintmax_t* usecs)
|
||||||
{
|
{
|
||||||
struct timespec uptime;
|
struct timespec uptime;
|
||||||
if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 )
|
if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
*usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL;
|
*usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
static int uptime(uintmax_t* usecs)
|
static int uptime(uintmax_t* usecs)
|
||||||
{
|
{
|
||||||
struct timespec uptime;
|
struct timespec uptime;
|
||||||
if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 )
|
if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
*usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL;
|
*usecs = uptime.tv_sec * 1000000ULL + uptime.tv_nsec / 1000ULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool WaitClear(volatile little_uint32_t* reg,
|
||||||
unsigned int msecs)
|
unsigned int msecs)
|
||||||
{
|
{
|
||||||
struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
while ( true )
|
||||||
|
@ -68,7 +68,7 @@ bool WaitSet(volatile little_uint32_t* reg,
|
||||||
unsigned int msecs)
|
unsigned int msecs)
|
||||||
{
|
{
|
||||||
struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
while ( true )
|
||||||
|
|
|
@ -56,7 +56,7 @@ static inline void delay(unsigned int usecs)
|
||||||
{
|
{
|
||||||
struct timespec delay =
|
struct timespec delay =
|
||||||
timespec_make(usecs / 1000000, (usecs % 1000000) * 1000);
|
timespec_make(usecs / 1000000, (usecs % 1000000) * 1000);
|
||||||
Clock* clock = Time::GetClock(CLOCK_BOOT);
|
Clock* clock = Time::GetClock(CLOCK_BOOTTIME);
|
||||||
clock->SleepDelay(delay);
|
clock->SleepDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ void Port::PrepareAwaitInterrupt()
|
||||||
bool Port::AwaitInterrupt(unsigned int msecs)
|
bool Port::AwaitInterrupt(unsigned int msecs)
|
||||||
{
|
{
|
||||||
struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
while ( true )
|
||||||
|
|
|
@ -52,7 +52,7 @@ static unsigned long AllocateDiskNumber()
|
||||||
static void sleep_400_nanoseconds()
|
static void sleep_400_nanoseconds()
|
||||||
{
|
{
|
||||||
struct timespec delay = timespec_make(0, 400);
|
struct timespec delay = timespec_make(0, 400);
|
||||||
Clock* clock = Time::GetClock(CLOCK_BOOT);
|
Clock* clock = Time::GetClock(CLOCK_BOOTTIME);
|
||||||
clock->SleepDelay(delay);
|
clock->SleepDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void copy_ata_string(char* dest, const char* src, size_t length)
|
||||||
static void sleep_400_nanoseconds()
|
static void sleep_400_nanoseconds()
|
||||||
{
|
{
|
||||||
struct timespec delay = timespec_make(0, 400);
|
struct timespec delay = timespec_make(0, 400);
|
||||||
Clock* clock = Time::GetClock(CLOCK_BOOT);
|
Clock* clock = Time::GetClock(CLOCK_BOOTTIME);
|
||||||
clock->SleepDelay(delay);
|
clock->SleepDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +860,7 @@ void Port::PrepareAwaitInterrupt()
|
||||||
bool Port::AwaitInterrupt(unsigned int msecs)
|
bool Port::AwaitInterrupt(unsigned int msecs)
|
||||||
{
|
{
|
||||||
struct timespec timeout = timespec_make(msecs / 1000, (msecs % 1000) * 1000000L);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
while ( true )
|
||||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
||||||
|
|
||||||
#define CLOCK_REALTIME 0 /* Current real time. */
|
#define CLOCK_REALTIME 0 /* Current real time. */
|
||||||
#define CLOCK_MONOTONIC 1 /* Always increasing 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_INIT 3 /* Time since 'init' process began. */
|
||||||
#define CLOCK_PROCESS_CPUTIME_ID 4
|
#define CLOCK_PROCESS_CPUTIME_ID 4
|
||||||
#define CLOCK_PROCESS_SYSTIME_ID 5
|
#define CLOCK_PROCESS_SYSTIME_ID 5
|
||||||
|
|
|
@ -48,7 +48,7 @@ Clock* GetClock(clockid_t clock)
|
||||||
switch ( clock )
|
switch ( clock )
|
||||||
{
|
{
|
||||||
case CLOCK_REALTIME: return realtime_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_INIT: return uptime_clock;
|
||||||
case CLOCK_MONOTONIC: return uptime_clock;
|
case CLOCK_MONOTONIC: return uptime_clock;
|
||||||
case CLOCK_PROCESS_CPUTIME_ID: return &CurrentProcess()->execute_clock;
|
case CLOCK_PROCESS_CPUTIME_ID: return &CurrentProcess()->execute_clock;
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace Sortix {
|
||||||
bool wait_inport8_clear(uint16_t ioport, uint8_t bits, bool any, unsigned int msecs)
|
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);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
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)
|
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);
|
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;
|
struct timespec begun;
|
||||||
clock->Get(&begun, NULL);
|
clock->Get(&begun, NULL);
|
||||||
while ( true )
|
while ( true )
|
||||||
|
|
|
@ -56,8 +56,8 @@ void PrintElement(size_t num, const char* single, const char* multiple)
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
struct timespec uptime;
|
struct timespec uptime;
|
||||||
if ( clock_gettime(CLOCK_BOOT, &uptime) < 0 )
|
if ( clock_gettime(CLOCK_BOOTTIME, &uptime) < 0 )
|
||||||
error(1, errno, "clock_gettime(CLOCK_BOOT)");
|
error(1, errno, "clock_gettime(CLOCK_BOOTTIME)");
|
||||||
|
|
||||||
uintmax_t usecssinceboot = uptime.tv_sec * 1000000ULL +
|
uintmax_t usecssinceboot = uptime.tv_sec * 1000000ULL +
|
||||||
uptime.tv_nsec / 1000ULL;
|
uptime.tv_nsec / 1000ULL;
|
||||||
|
|
Loading…
Reference in New Issue