Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gettimer(3)

setclock(3)

time(3)

getclock(3)  —  Subroutines

OSF

NAME

getclock − Gets current value of system-wide clock

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <sys/timers.h>

int getclock(
int clktyp,
struct timespec ∗tp) ;

PARAMETERS

clktypIdentifies a system-wide clock. 

tpPoints to a timespec structure space where the current value of the system-wide clock is stored. 

DESCRIPTION

The getclock() function sets the current value of the clock specified by clktyp into the location pointed to by the tp parameter. 

The clktyp parameter is given as a symbolic constant name, as defined in the sys/timers.h include file. Only the TIMEOFDAY symbolic constant, which specifies the normal time-of-day clock to access for system-wide time, is supported. 

For the clock specified by TIMEOFDAY, the value returned by this function is the elapsed time since the epoch. The epoch is referenced to 00:00:00 CUT (Coordinated Universal Time) 1 Jan 1970. 

The getclock() function returns a timespec structure, which is defined in the sys/timers.h header file.  It has the following members:

unsigned long tv_sec Elapsed time in seconds since the epoch
long tv_nsec Elapsed time as a fraction of a second since the epoch (expressed in nanoseconds)

The time interval expressed by the members of this  structure is ((tv_sec ∗ 109) + (tv_nsec)) nanoseconds. 

NOTES

AES Support Level:
Trial use

RETURN VALUES

Upon successful completion, the getclock() function returns a value of 0 (zero).  Otherwise, getclock() returns a value of -1 and sets errno to indicate the error. 

ERRORS

If the getclock() function fails, errno may be set to one of the following values:

[EINVAL]The clktyp parameter does not specify a known system-wide clock. 

[EIO]An error occurred when the system-wide clock specified by the clktyp parameter was accessed. 

RELATED INFORMATION

Functions: gettimer(3), setclock(3), time(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026