/* <vms/lib/utcdef.h>
 *
 *	LIB - universal time coordinate definitions	[not in Starlet]
 */
#ifndef _UTCDEF_H
#define _UTCDEF_H

/*
   $UTCDEF defines the storage format for UTC based times.

	[note:	the field names will undoubtedly change once this becomes
		documented, because the SDL definition is obviously wrong. ]
 */
#define UTC$V_TDF	0
#define UTC$M_TDF	0x0FFF
#define UTC$S_TDF	12
#define UTC$V_VER	12
#define UTC$M_VER	0xF000
#define UTC$S_VER	4

#define UTC$S_WHOLE_TIME 16
#define UTC$S_ABSTIME	8
#define UTC$S_TDF_ETC	8
#define UTC$S_INACCUR	6

#define UTC$S_UTCDEF	16
struct utcdef {
    union {
	struct {
	    long utc$a_whole_time[2][2];    /* double quad to fetch entire time */
	} utc$r_utcdef_wtim;
	struct {
	    long utc$q_abstime[2];	    /* 64 bit system time in units of 100ns ticks */
	    long utc$q_tdf_etc[2];	    /* inaccuracy, TDF, and version */
	} utc$r_utcdef_quad0;
	struct {
	    unsigned long utc$l_abs0;	    /* least sig 4 bytes of binary time */
	    unsigned long utc$l_abs1;	    /* most sig 4 bytes of binary time */
	    unsigned long utc$l_inac;	    /* 4 least sig bytes of inaccuracy */
	    unsigned long utc$l_tdfv;	    /* 4 bits vers, 12 bits TDF, 2 most sig bytes of inaccuracy */
	} utc$r_utcdef_long0;
	struct {    /* [note: this part is wrong in lib.req and utcdef.sdl] */
	    unsigned	: 32, : 32;
	    unsigned char utc$a_inaccur[6];	/* Six bytes of inaccuracy in units of 100ns ticks */
	    union {
		unsigned short utc$w_tdfwrd;	/* fetch the TDF and the version */
		struct {
		    unsigned utc$v_tdf : 12;	/* 12 bits of offset from UTC to local in units of minutes */
		    unsigned utc$v_ver : 4;	/* unsigned version number */
		} utc$r_tdfwrd_fields;
	    } utc$r_tdfwrd_overlay;
	} utc$r_utcdef_fld0;
    } utc$r_utcdef_time;
};

#endif	/*_UTCDEF_H*/
