icon Top 9 categories map      RocketAware > man pages >


Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.

The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Search all pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


RocketLink!--> Man page versions: OpenBSD FreeBSD Others

CLOCK_GETTIME(2)          OpenBSD Programmer's Manual         CLOCK_GETTIME(2)

     clock_gettime, clock_settime, clock_getres - get/set/calibrate date and

     #include <sys/time.h>

     clock_gettime(clockid_t clock_id, struct timespec *tp);

     clock_settime(clockid_t clock_id, const struct timespec *tp);

     clock_getres(clockid_t clock_id, struct timespec *tp);

     The clock_gettime() and clock_settime() allow the calling process to re-
     trieve or set the value used by a clock which is specified by clock_id.

     clock_id can be one of three values: CLOCK_REALTIME for time that incre-
     ments as a wall clock should, CLOCK_VIRTUAL for time that increments only
     when the CPU is running in user mode on behalf of the calling process, or
     CLOCK_PROF for time that increments when the CPU is running in user or
     kernel mode.

     The structure pointed to by tp is defined in <sys/time.h> as:

     struct timespec {
             time_t  tv_sec;         /* seconds */
             long    tv_nsec;        /* and nanoseconds */

     Only the super-user may set the time of day.  If the system securelevel
     is greater than 1 (see init(8)),  the time may only be advanced.  This
     limitation is imposed to prevent a malicious super-user from setting ar-
     bitrary time stamps on files.  The system time can still be adjusted
     backwards using the adjtime(2) system call even when the system is se-

     The resolution (granularity) of a clock is returned by the clock_getres()
     call.  This value is placed in a (non-null) *tp.

     A 0 return value indicates that the call succeeded.  A -1 return value
     indicates an error occurred, and in this case an error code is stored in-
     to the global variable errno.

     The following error codes may be set in errno:

     [EINVAL]  The clock_id was not a valid value.

     [EFAULT]  The *tp argument address referenced invalid memory.

     [EPERM]   A user other than the super-user attempted to set the time.

     date(1),  adjtime(2),  ctime(3),  timed(8)

     The clock_gettime(), etc.  functions conform to IEEE Std1003.1b-1993

OpenBSD 2.6                       May 8, 1997                                1

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.

(Corrections, notes, and links courtesy of RocketAware.com)

[Detailed Topics]

[Overview Topics]

Up to: Calendar and Time of Day - Calendar and Time of Day (conversions, manipulations, etc)
Up to: Local machine and Operating System Information - kernel topics, uname, boot, shutdown, et al
Up to: System Administration - Configuration, installing software, adding users, setting limits, system startup (boot) et al.

RocketLink!--> Man page versions: OpenBSD FreeBSD Others

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > clock_gettime.2/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments