AlcapDAQ  1
dummy_master.cpp
Go to the documentation of this file.
1 #include <time.h>
2 #include <sys/time.h>
3 
4 #include <stdio.h>
5 #include <stdlib.h>
6 
7 #include "midas.h"
8 #include "crate.h"
9 
13 
15  NULL, // init
16  NULL, // exit
17  NULL, // pre_bor
18  NULL, // bor
19  NULL, // eor
20  dummy_master_poll_live, // poll_live
21  dummy_master_poll_dead, // poll_dead
22  dummy_master_start_block, // start_block
23  NULL, // stop_block
24  NULL, // read
25 };
26 
27 struct timeval block_start_time;
28 
30 {
31  gettimeofday(&block_start_time, 0);
32 }
33 
35 {
36  struct timeval now;
37  gettimeofday(&now, 0);
38  double increment = (now.tv_sec - block_start_time.tv_sec)*1e6 +
39  (now.tv_usec - block_start_time.tv_usec);
40 
41  if(increment > 0.1e6) {
42  return FE_END_BLOCK;
43  } else {
44  return SUCCESS;
45  }
46 }
47 
49 {
50  return FE_NEED_START;
51 }
52