xref: /titanic_50/usr/src/lib/libast/sparc/include/ast/tv.h (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1da2e3ebdSchin /***********************************************************************
2da2e3ebdSchin *                                                                      *
3da2e3ebdSchin *               This software is part of the ast package               *
4*3e14f97fSRoger A. Faulkner *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5da2e3ebdSchin *                      and is licensed under the                       *
6da2e3ebdSchin *                  Common Public License, Version 1.0                  *
77c2fbfb3SApril Chin *                    by AT&T Intellectual Property                     *
8da2e3ebdSchin *                                                                      *
9da2e3ebdSchin *                A copy of the License is available at                 *
10da2e3ebdSchin *            http://www.opensource.org/licenses/cpl1.0.txt             *
11da2e3ebdSchin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12da2e3ebdSchin *                                                                      *
13da2e3ebdSchin *              Information and Software Systems Research               *
14da2e3ebdSchin *                            AT&T Research                             *
15da2e3ebdSchin *                           Florham Park NJ                            *
16da2e3ebdSchin *                                                                      *
17da2e3ebdSchin *                 Glenn Fowler <gsf@research.att.com>                  *
18da2e3ebdSchin *                  David Korn <dgk@research.att.com>                   *
19da2e3ebdSchin *                   Phong Vo <kpv@research.att.com>                    *
20da2e3ebdSchin *                                                                      *
21da2e3ebdSchin ***********************************************************************/
22da2e3ebdSchin 
23da2e3ebdSchin /* : : generated by proto : : */
24*3e14f97fSRoger A. Faulkner /* : : generated from /home/gisburn/ksh93/ast_ksh_20100309/build_sparc_32bit/src/lib/libast/features/tv by iffe version 2009-12-04 : : */
25da2e3ebdSchin 
26da2e3ebdSchin #ifndef _TV_H
27da2e3ebdSchin #if !defined(__PROTO__)
28da2e3ebdSchin #  if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
29da2e3ebdSchin #    if defined(__cplusplus)
30da2e3ebdSchin #      define __LINKAGE__	"C"
31da2e3ebdSchin #    else
32da2e3ebdSchin #      define __LINKAGE__
33da2e3ebdSchin #    endif
34da2e3ebdSchin #    define __STDARG__
35da2e3ebdSchin #    define __PROTO__(x)	x
36da2e3ebdSchin #    define __OTORP__(x)
37da2e3ebdSchin #    define __PARAM__(n,o)	n
38da2e3ebdSchin #    if !defined(__STDC__) && !defined(__cplusplus)
39da2e3ebdSchin #      if !defined(c_plusplus)
40da2e3ebdSchin #      	define const
41da2e3ebdSchin #      endif
42da2e3ebdSchin #      define signed
43da2e3ebdSchin #      define void		int
44da2e3ebdSchin #      define volatile
45da2e3ebdSchin #      define __V_		char
46da2e3ebdSchin #    else
47da2e3ebdSchin #      define __V_		void
48da2e3ebdSchin #    endif
49da2e3ebdSchin #  else
50da2e3ebdSchin #    define __PROTO__(x)	()
51da2e3ebdSchin #    define __OTORP__(x)	x
52da2e3ebdSchin #    define __PARAM__(n,o)	o
53da2e3ebdSchin #    define __LINKAGE__
54da2e3ebdSchin #    define __V_		char
55da2e3ebdSchin #    define const
56da2e3ebdSchin #    define signed
57da2e3ebdSchin #    define void		int
58da2e3ebdSchin #    define volatile
59da2e3ebdSchin #  endif
60da2e3ebdSchin #  define __MANGLE__	__LINKAGE__
61da2e3ebdSchin #  if defined(__cplusplus) || defined(c_plusplus)
62da2e3ebdSchin #    define __VARARG__	...
63da2e3ebdSchin #  else
64da2e3ebdSchin #    define __VARARG__
65da2e3ebdSchin #  endif
66da2e3ebdSchin #  if defined(__STDARG__)
67da2e3ebdSchin #    define __VA_START__(p,a)	va_start(p,a)
68da2e3ebdSchin #  else
69da2e3ebdSchin #    define __VA_START__(p,a)	va_start(p)
70da2e3ebdSchin #  endif
71da2e3ebdSchin #  if !defined(__INLINE__)
72da2e3ebdSchin #    if defined(__cplusplus)
73da2e3ebdSchin #      define __INLINE__	extern __MANGLE__ inline
74da2e3ebdSchin #    else
75da2e3ebdSchin #      if defined(_WIN32) && !defined(__GNUC__)
76da2e3ebdSchin #      	define __INLINE__	__inline
77da2e3ebdSchin #      endif
78da2e3ebdSchin #    endif
79da2e3ebdSchin #  endif
80da2e3ebdSchin #endif
81da2e3ebdSchin #if !defined(__LINKAGE__)
82da2e3ebdSchin #define __LINKAGE__		/* 2004-08-11 transition */
83da2e3ebdSchin #endif
84da2e3ebdSchin 
85da2e3ebdSchin #define _TV_H	1
86da2e3ebdSchin /*
87da2e3ebdSchin  * AT&T Research
88da2e3ebdSchin  *
89da2e3ebdSchin  * high resolution Tv_t interface definitions
90da2e3ebdSchin  */
91da2e3ebdSchin 
92da2e3ebdSchin #include <ast.h>
93da2e3ebdSchin 
94da2e3ebdSchin #define TV_NSEC_IGNORE		(1000000000L)
95da2e3ebdSchin #define TV_TOUCH_RETAIN		((Tv_t*)1)
96da2e3ebdSchin 
97da2e3ebdSchin typedef struct Tv_s
98da2e3ebdSchin {
99da2e3ebdSchin 	uint32_t	tv_sec;
100da2e3ebdSchin 	uint32_t	tv_nsec;
101da2e3ebdSchin } Tv_t;
102da2e3ebdSchin 
103da2e3ebdSchin #define ST_ATIME_NSEC_GET(st)	((st)->st_atim.tv_nsec)
104da2e3ebdSchin #define ST_CTIME_NSEC_GET(st)	((st)->st_ctim.tv_nsec)
105da2e3ebdSchin #define ST_MTIME_NSEC_GET(st)	((st)->st_mtim.tv_nsec)
106da2e3ebdSchin 
107da2e3ebdSchin #define ST_ATIME_NSEC_SET(st,n)	(ST_ATIME_NSEC_GET(st)=(n))
108da2e3ebdSchin #define ST_CTIME_NSEC_SET(st,n)	(ST_CTIME_NSEC_GET(st)=(n))
109da2e3ebdSchin #define ST_MTIME_NSEC_SET(st,n)	(ST_MTIME_NSEC_GET(st)=(n))
110da2e3ebdSchin 
111da2e3ebdSchin #define tvgetatime(t,s)	((t)->tv_nsec=ST_ATIME_NSEC_GET(s),(t)->tv_sec=(s)->st_atime)
112da2e3ebdSchin #define tvgetmtime(t,s)	((t)->tv_nsec=ST_MTIME_NSEC_GET(s),(t)->tv_sec=(s)->st_mtime)
113da2e3ebdSchin #define tvgetctime(t,s)	((t)->tv_nsec=ST_CTIME_NSEC_GET(s),(t)->tv_sec=(s)->st_ctime)
114da2e3ebdSchin 
115da2e3ebdSchin #define tvsetatime(t,s)	(ST_ATIME_NSEC_SET(s,(t)->tv_nsec),(s)->st_atime=(t)->tv_sec)
116da2e3ebdSchin #define tvsetmtime(t,s)	(ST_MTIME_NSEC_SET(s,(t)->tv_nsec),(s)->st_mtime=(t)->tv_sec)
117da2e3ebdSchin #define tvsetctime(t,s)	(ST_CTIME_NSEC_SET(s,(t)->tv_nsec),(s)->st_ctime=(t)->tv_sec)
118da2e3ebdSchin 
119da2e3ebdSchin #if _BLD_ast && defined(__EXPORT__)
120da2e3ebdSchin #undef __MANGLE__
121da2e3ebdSchin #define __MANGLE__ __LINKAGE__		__EXPORT__
122da2e3ebdSchin #endif
123da2e3ebdSchin 
124da2e3ebdSchin extern __MANGLE__ int		tvgettime __PROTO__((Tv_t*));
125da2e3ebdSchin extern __MANGLE__ int		tvsettime __PROTO__((const Tv_t*));
126da2e3ebdSchin extern __MANGLE__ int		tvcmp __PROTO__((const Tv_t*, const Tv_t*));
127da2e3ebdSchin extern __MANGLE__ int		tvtouch __PROTO__((const char*, const Tv_t*, const Tv_t*, const Tv_t*, int));
128da2e3ebdSchin extern __MANGLE__ int		tvsleep __PROTO__((const Tv_t*, Tv_t*));
129da2e3ebdSchin 
130da2e3ebdSchin extern __MANGLE__ char*		fmttv __PROTO__((const char*, Tv_t*));
131da2e3ebdSchin 
132da2e3ebdSchin #endif
133