HOPS
HOPS class reference
hetetimecode.h
Go to the documentation of this file.
1 /*
2  * $Id: hetetimecode.h 80 2007-05-11 16:10:54Z gbc $
3  *
4  * HETE clock globals.
5  *
6  * Copyright (C) 1998 by MIT. All rights reserved.
7  */
8 
9 #ifndef _HETETIMECODE_H
10 #define _HETETIMECODE_H
11 
12 typedef unsigned short IPP_word;
13 
14 typedef struct
15 {
16  IPP_word time[4];
17 } time_code;
18 
19 /* Words are in little-endian order:
20  * time[0] is microseconds.
21  * time[1] units are about 66 ms.
22  * time[2] units are about 1.2 hours
23  * time[3] units are about 9 years.
24  *
25  * time[3] codes the "epoch" of the time. On the spacecraft, the epoch
26  * is determined by the digital watch's jumpers. In other environments,
27  * it depends on the clock source:
28  */
29 
30 #define EPOCH_NULL 0 /* no clock available */
31 #define EPOCH_UNSYNC 0x1 /* raw unsynchronized processor time */
32 #define EPOCH_HUBSYNC 0x2 /* HUB synchronized time, no watch */
33 #define EPOCH_WATCH(N) (0x10|(N)) /* synchronized to watch 0<=N<=15 */
34 #define EPOCH_UNIX(N) (0x20|(N)) /* Unix sys time, N is 4 MSB's */
35 
36 /* note that HETE-II started in EPOCH_UNIX(3). EPOCH_UNIX(4) will begin
37  * January 10, 2004 at 13:37:04 UT
38  */
39 
40 /*
41  * Epoch 003X will be used for IBEX.
42  */
43 #define THIS_IS_IBEX ((Ht_hete_epoch & 0x30) == 0x30)
44 #define EPOCH_IBEX(N) (0x30|(N))
45 
46 /* The HETE-I interface: returns microseconds as an unsigned as well as the
47  * code. The pointer may be null if you don't want the code.
48  */
49 
50 extern unsigned get_sc_time(time_code *tc);
51 
52 /* A slightly lower level interface, for your convenience in constructing
53  * messages as arrays:
54  */
55 
56 extern void get_sc_time_array(IPP_word time[4]);
57 
58 /* Ordering functions */
59 extern int time_cmp(time_code *time1, time_code *time2);
60 extern int has_this_time_passed(time_code *time);
61 
62 #endif /* _HETETIMECODE_H */
63 
64 /*
65  * eof
66  */
unsigned short IPP_word
Definition: hetetimecode.h:12
unsigned get_sc_time(time_code *tc)
Definition: sc_time.c:46
int time_cmp(time_code *time1, time_code *time2)
Definition: sc_time.c:67
int has_this_time_passed(time_code *time)
Definition: sc_time.c:92
void get_sc_time_array(IPP_word time[4])
Definition: sc_time.c:23
Definition: hetetimecode.h:15