Print this page
remove support for non-ANSI compilation
   1 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
   2 /*        All Rights Reserved   */
   3 
   4 
   5 /*
   6  * Copyright (c) 1982, 1986, 1993 Regents of the University of California.
   7  * All rights reserved.  The Berkeley software License Agreement
   8  * specifies the terms and conditions for redistribution.
   9  */
  10 
  11 /*


  12  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  13  * Use is subject to license terms.
  14  */
  15 
  16 #ifndef _SYS_TIME_H
  17 #define _SYS_TIME_H
  18 
  19 #include <sys/feature_tests.h>
  20 
  21 /*
  22  * Structure returned by gettimeofday(2) system call,
  23  * and used in other calls.
  24  */
  25 
  26 #ifdef  __cplusplus
  27 extern "C" {
  28 #endif
  29 
  30 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
  31         defined(__EXTENSIONS__)


 355 extern  hrtime_t        ts2hrt(const timestruc_t *);
 356 extern  void            hrt2tv(hrtime_t, struct timeval *);
 357 extern  hrtime_t        tv2hrt(struct timeval *);
 358 extern  int             itimerfix(struct timeval *, int);
 359 extern  int             itimerdecr(struct itimerval *, int);
 360 extern  void            timevaladd(struct timeval *, struct timeval *);
 361 extern  void            timevalsub(struct timeval *, struct timeval *);
 362 extern  void            timevalfix(struct timeval *);
 363 extern  void            dtrace_hres_tick(void);
 364 
 365 extern clock_t          ddi_get_lbolt(void);
 366 extern int64_t          ddi_get_lbolt64(void);
 367 
 368 #if defined(_SYSCALL32)
 369 extern  void            hrt2ts32(hrtime_t, timestruc32_t *);
 370 #endif
 371 
 372 #endif /* _KERNEL */
 373 
 374 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 375 #if defined(__STDC__)
 376 int adjtime(struct timeval *, struct timeval *);
 377 #else
 378 int adjtime();
 379 #endif
 380 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 381 
 382 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
 383         defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)
 384 #if defined(__STDC__)
 385 int futimesat(int, const char *, const struct timeval *);
 386 #else
 387 int futimesat();
 388 #endif /* defined(__STDC__) */
 389 #endif /* defined(__ATFILE_SOURCE) */
 390 
 391 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 392         defined(__EXTENSIONS__)
 393 
 394 #if defined(__STDC__)
 395 
 396 int getitimer(int, struct itimerval *);
 397 int utimes(const char *, const struct timeval *);
 398 #if defined(_XPG4_2)
 399 int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
 400         struct itimerval *_RESTRICT_KYWD);
 401 #else
 402 int setitimer(int, struct itimerval *_RESTRICT_KYWD,
 403         struct itimerval *_RESTRICT_KYWD);
 404 #endif /* defined(_XPG2_2) */
 405 
 406 #else /* __STDC__ */
 407 
 408 int gettimer();
 409 int settimer();
 410 int utimes();
 411 #endif /* __STDC__ */
 412 #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
 413 
 414 /*
 415  * gettimeofday() and settimeofday() were included in SVr4 due to their
 416  * common use in BSD based applications.  They were to be included exactly
 417  * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 418  * parameter was unused and deleted it, thereby making a routine included
 419  * for compatibility, incompatible.
 420  *
 421  * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 422  * parameters.
 423  *
 424  * This has caused general disagreement in the application community as to
 425  * the syntax of these routines.  Solaris defaults to the XSH4.2 definition.
 426  * The flag _SVID_GETTOD may be used to force the SVID version.
 427  */
 428 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 429 
 430 #if defined(__STDC__)
 431 #if defined(_SVID_GETTOD)
 432 int settimeofday(struct timeval *);
 433 #else
 434 int settimeofday(struct timeval *, void *);
 435 #endif
 436 hrtime_t        gethrtime(void);
 437 hrtime_t        gethrvtime(void);
 438 #else /* __STDC__ */
 439 int settimeofday();
 440 hrtime_t        gethrtime();
 441 hrtime_t        gethrvtime();
 442 #endif /* __STDC__ */
 443 
 444 #endif /* !(defined _KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 445 
 446 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 447         defined(__EXTENSIONS__)
 448 
 449 #if defined(__STDC__)
 450 #if defined(_SVID_GETTOD)
 451 int gettimeofday(struct timeval *);
 452 #else
 453 int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
 454 #endif
 455 #else /* __STDC__ */
 456 int gettimeofday();
 457 #endif /* __STDC__ */
 458 
 459 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 460 
 461 /*
 462  * The inclusion of <time.h> is historical and was added for
 463  * backward compatibility in delta 1.2 when a number of definitions
 464  * were moved out of <sys/time.h>.  More recently, the timespec and
 465  * itimerspec structure definitions, along with the _CLOCK_*, CLOCK_*,
 466  * _TIMER_*, and TIMER_* symbols were moved to <sys/time_impl.h>,
 467  * which is now included by <time.h>.  This change was due to POSIX
 468  * 1003.1b-1993 and X/Open UNIX 98 requirements.  For non-POSIX and
 469  * non-X/Open applications, including this header will still make
 470  * visible these definitions.
 471  */
 472 #if !defined(_BOOT) && !defined(_KERNEL) && \
 473         !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 474 #include <time.h>
 475 #endif
 476 
 477 /*
   1 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
   2 /*        All Rights Reserved   */
   3 
   4 
   5 /*
   6  * Copyright (c) 1982, 1986, 1993 Regents of the University of California.
   7  * All rights reserved.  The Berkeley software License Agreement
   8  * specifies the terms and conditions for redistribution.
   9  */
  10 
  11 /*
  12  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  13  *
  14  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  15  * Use is subject to license terms.
  16  */
  17 
  18 #ifndef _SYS_TIME_H
  19 #define _SYS_TIME_H
  20 
  21 #include <sys/feature_tests.h>
  22 
  23 /*
  24  * Structure returned by gettimeofday(2) system call,
  25  * and used in other calls.
  26  */
  27 
  28 #ifdef  __cplusplus
  29 extern "C" {
  30 #endif
  31 
  32 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
  33         defined(__EXTENSIONS__)


 357 extern  hrtime_t        ts2hrt(const timestruc_t *);
 358 extern  void            hrt2tv(hrtime_t, struct timeval *);
 359 extern  hrtime_t        tv2hrt(struct timeval *);
 360 extern  int             itimerfix(struct timeval *, int);
 361 extern  int             itimerdecr(struct itimerval *, int);
 362 extern  void            timevaladd(struct timeval *, struct timeval *);
 363 extern  void            timevalsub(struct timeval *, struct timeval *);
 364 extern  void            timevalfix(struct timeval *);
 365 extern  void            dtrace_hres_tick(void);
 366 
 367 extern clock_t          ddi_get_lbolt(void);
 368 extern int64_t          ddi_get_lbolt64(void);
 369 
 370 #if defined(_SYSCALL32)
 371 extern  void            hrt2ts32(hrtime_t, timestruc32_t *);
 372 #endif
 373 
 374 #endif /* _KERNEL */
 375 
 376 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)

 377 int adjtime(struct timeval *, struct timeval *);



 378 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 379 
 380 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || \
 381         defined(_ATFILE_SOURCE) || defined(__EXTENSIONS__)

 382 int futimesat(int, const char *, const struct timeval *);



 383 #endif /* defined(__ATFILE_SOURCE) */
 384 
 385 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 386         defined(__EXTENSIONS__)
 387 


 388 int getitimer(int, struct itimerval *);
 389 int utimes(const char *, const struct timeval *);
 390 #if defined(_XPG4_2)
 391 int setitimer(int, const struct itimerval *_RESTRICT_KYWD,
 392         struct itimerval *_RESTRICT_KYWD);
 393 #else
 394 int setitimer(int, struct itimerval *_RESTRICT_KYWD,
 395         struct itimerval *_RESTRICT_KYWD);
 396 #endif /* defined(_XPG2_2) */
 397 






 398 #endif /* !defined(_KERNEL) ... defined(_XPG4_2) */
 399 
 400 /*
 401  * gettimeofday() and settimeofday() were included in SVr4 due to their
 402  * common use in BSD based applications.  They were to be included exactly
 403  * as in BSD, with two parameters.  However, AT&T/USL noted that the second
 404  * parameter was unused and deleted it, thereby making a routine included
 405  * for compatibility, incompatible.
 406  *
 407  * XSH4.2 (spec 1170) defines gettimeofday and settimeofday to have two
 408  * parameters.
 409  *
 410  * This has caused general disagreement in the application community as to
 411  * the syntax of these routines.  Solaris defaults to the XSH4.2 definition.
 412  * The flag _SVID_GETTOD may be used to force the SVID version.
 413  */
 414 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 415 

 416 #if defined(_SVID_GETTOD)
 417 int settimeofday(struct timeval *);
 418 #else
 419 int settimeofday(struct timeval *, void *);
 420 #endif
 421 hrtime_t        gethrtime(void);
 422 hrtime_t        gethrvtime(void);





 423 
 424 #endif /* !(defined _KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 425 
 426 #if !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
 427         defined(__EXTENSIONS__)
 428 

 429 #if defined(_SVID_GETTOD)
 430 int gettimeofday(struct timeval *);
 431 #else
 432 int gettimeofday(struct timeval *_RESTRICT_KYWD, void *_RESTRICT_KYWD);
 433 #endif



 434 
 435 #endif /* !defined(_KERNEL) && !defined(__XOPEN_OR_POSIX) ... */
 436 
 437 /*
 438  * The inclusion of <time.h> is historical and was added for
 439  * backward compatibility in delta 1.2 when a number of definitions
 440  * were moved out of <sys/time.h>.  More recently, the timespec and
 441  * itimerspec structure definitions, along with the _CLOCK_*, CLOCK_*,
 442  * _TIMER_*, and TIMER_* symbols were moved to <sys/time_impl.h>,
 443  * which is now included by <time.h>.  This change was due to POSIX
 444  * 1003.1b-1993 and X/Open UNIX 98 requirements.  For non-POSIX and
 445  * non-X/Open applications, including this header will still make
 446  * visible these definitions.
 447  */
 448 #if !defined(_BOOT) && !defined(_KERNEL) && \
 449         !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
 450 #include <time.h>
 451 #endif
 452 
 453 /*