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