int main(int argc, char **argv)
{
if (argc < 3)
- error("usage: host /dev/ttyACM0 0 sync");
+ error("usage: control /dev/ttyACM0 0 sync");
// Parse args
char *opt_tty = argv[1];
body.start.nanosec = 0; //ts.tv_nsec;
body.period.seconds = 0;
body.period.nanosec = 100000000;
- // [ ][ ]
+ // [s][m][u][n]
// Transmit message
FILE *fd = fopen(opt_tty, "a+");
// Convert timestamp
uint64_t world = time_to_world(local);
- ntime_t ntime = serial_write_time(world);
+ ntime_t ltime = serial_write_time(local);
+ ntime_t wtime = serial_write_time(world);
// Message data
header_t head = {};
body.device = serial_device_id;
body.event = event;
- body.time = ntime;
+ body.world = ltime;
+ body.local = wtime;
// Transmit message to BBB
sirq_write(port, &head, sizeof(head));
} msgid_t;
typedef struct {
- uint32_t seconds; // Seconds since 1970 (without leap seconds)
+ uint32_t seconds; // Seconds since 1970
uint32_t nanosec; // Nanoseconds since 'seconds'
} ntime_t;
typedef struct {
uint16_t valid; // Message valid bits
uint16_t device; // Device ID to use
+ ntime_t world; // World time (since 1970)
ntime_t start; // Transmit start time
ntime_t period; // Transmit period
- ntime_t world; // World time (since 1970)
} init_msg_t;
typedef struct {
typedef struct {
uint16_t device; // Device ID
uint16_t event; // Event ID
- ntime_t time; // Timestamp
+ ntime_t world; // UTC Time of event
+ ntime_t local; // Time since turn-on
} event_msg_t;
#pragma pack()