xref: /illumos-gate/usr/src/cmd/ast/libast/sparc/FEATURE/tmx (revision e7afc443cb8c2e0a379fe48b15a0c7fb61a4b2fc)
1
2/* : : generated by proto : : */
3/* : : generated from contrib/ast/src/lib/libast/features/tmx by iffe version 2012-07-17 : : */
4
5#ifndef _TMX_H
6#if !defined(__PROTO__)
7#  if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
8#    if defined(__cplusplus)
9#      define __LINKAGE__	"C"
10#    else
11#      define __LINKAGE__
12#    endif
13#    define __STDARG__
14#    define __PROTO__(x)	x
15#    define __OTORP__(x)
16#    define __PARAM__(n,o)	n
17#    if !defined(__STDC__) && !defined(__cplusplus)
18#      if !defined(c_plusplus)
19#      	define const
20#      endif
21#      define signed
22#      define void		int
23#      define volatile
24#      define __V_		char
25#    else
26#      define __V_		void
27#    endif
28#  else
29#    define __PROTO__(x)	()
30#    define __OTORP__(x)	x
31#    define __PARAM__(n,o)	o
32#    define __LINKAGE__
33#    define __V_		char
34#    define const
35#    define signed
36#    define void		int
37#    define volatile
38#  endif
39#  define __MANGLE__	__LINKAGE__
40#  if defined(__cplusplus) || defined(c_plusplus)
41#    define __VARARG__	...
42#  else
43#    define __VARARG__
44#  endif
45#  if defined(__STDARG__)
46#    define __VA_START__(p,a)	va_start(p,a)
47#  else
48#    define __VA_START__(p,a)	va_start(p)
49#  endif
50#  if !defined(__INLINE__)
51#    if defined(__cplusplus)
52#      define __INLINE__	extern __MANGLE__ inline
53#    else
54#      if defined(_WIN32) && !defined(__GNUC__)
55#      	define __INLINE__	__inline
56#      endif
57#    endif
58#  endif
59#endif
60#if !defined(__LINKAGE__)
61#define __LINKAGE__		/* 2004-08-11 transition */
62#endif
63
64#define _TMX_H	1
65/*
66 * AT&T Research
67 *
68 * high resolution Time_t support
69 */
70
71#include <tm.h>
72#include <tv.h>
73
74#define TMX_MAXDATE	"2554-07-21+23:34:33.709551614 UTC"
75#define TMX_MAXYEAR	2554
76#define TMX_MAXSEC	((Time_t)18446744073)
77#define TMX_MAXNSEC	709551614
78#define TMX_RESOLUTION	1000000000
79
80typedef uint64_t Time_t;
81typedef uint64_t Tmxsec_t;
82typedef uint32_t Tmxnsec_t;
83
84#define tmxsec(t)	((Tmxsec_t)((t)/1000000000))
85#define tmxnsec(t)	((Tmxnsec_t)((t)%1000000000))
86#define tmxsns(s,n)	(((((Time_t)(s))*1000000000))+((Time_t)(n)))
87
88#define TMX_NOTIME	((Time_t)(-1))
89#define TMX_NOW		tmxgettime()
90#define TMX_MAXTIME	tmxsns(TMX_MAXSEC,TMX_MAXNSEC)
91
92#define tmx2tv(t,v)	((v)->tv_nsec=tmxnsec(t),(v)->tv_sec=tmxsec(t))
93#define tv2tmx(v)	tmxsns((v)->tv_sec,(v)->tv_nsec)
94
95#define tmxclock(p)	tmxsns(((p)?*(p):time(NiL)),0)
96
97#define tmxgetatime(s)	tmxsns((s)->st_atime,ST_ATIME_NSEC_GET(s))
98#define tmxgetctime(s)	tmxsns((s)->st_ctime,ST_CTIME_NSEC_GET(s))
99#define tmxgetmtime(s)	tmxsns((s)->st_mtime,ST_MTIME_NSEC_GET(s))
100
101#define tmxsetatime(s,t) ((s)->st_atime=tmxsec(t),ST_ATIME_NSEC_SET(s,tmxnsec(t)))
102#define tmxsetctime(s,t) ((s)->st_ctime=tmxsec(t),ST_CTIME_NSEC_SET(s,tmxnsec(t)))
103#define tmxsetmtime(s,t) ((s)->st_mtime=tmxsec(t),ST_MTIME_NSEC_SET(s,tmxnsec(t)))
104
105#if _BLD_ast && defined(__EXPORT__)
106#undef __MANGLE__
107#define __MANGLE__ __LINKAGE__		__EXPORT__
108#endif
109
110extern __MANGLE__ Time_t		tmxdate __PROTO__((const char*, char**, Time_t));
111extern __MANGLE__ Time_t		tmxduration __PROTO__((const char*, char**));
112extern __MANGLE__ char*		tmxfmt __PROTO__((char*, size_t, const char*, Time_t));
113extern __MANGLE__ Time_t		tmxleap __PROTO__((Time_t));
114extern __MANGLE__ Tm_t*		tmxmake __PROTO__((Time_t));
115extern __MANGLE__ Time_t		tmxscan __PROTO__((const char*, char**, const char*, char**, Time_t, long));
116extern __MANGLE__ int		tmxsleep __PROTO__((Time_t));
117extern __MANGLE__ Time_t		tmxtime __PROTO__((Tm_t*, int));
118extern __MANGLE__ Tm_t*		tmxtm __PROTO__((Tm_t*, Time_t, Tm_zone_t*));
119
120extern __MANGLE__ Time_t		tmxgettime __PROTO__((void));
121extern __MANGLE__ int		tmxsettime __PROTO__((Time_t));
122
123extern __MANGLE__ int		tmxtouch __PROTO__((const char*, Time_t, Time_t, Time_t, int));
124
125extern __MANGLE__ char*		fmttmx __PROTO__((const char*, Time_t));
126
127#undef __MANGLE__
128#define __MANGLE__ __LINKAGE__
129
130#endif
131