summaryrefslogtreecommitdiffstats
path: root/app/stats.c
blob: dfed0179d0ad1ef853a719e7b3832afdbe621951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "project.h"


void stats (void)
{
  int64_t d;
  EPOCH e;
  UTC m, g;
  float ms;

  d = msf_last_second;
  d -= (int64_t) dcf77_last_second;

  g = time_epoch_to_utc (pll_decompose (dcf77_last_second));
  m = time_epoch_to_utc (pll_decompose (msf_last_second));
  e = pll_decompose_diff (d);

  ms = (float) e.ns;
  ms = ms / 1000000.0;

  printf ("MSF %02d:%02d:%02d.%09d %02d.%09d  %+.6f ms %u\r\n",
          m.hour,
          m.minute,
          m.second,
          m.nanosecond,
          g.second,
          g.nanosecond,
          ms,
          (unsigned) pll_freq);

}
void stats_stamp (UTC m, uint64_t abs)
{
  uint32_t v, w;
  v = msf_last_second & 0xffffffff;
  w = msf_last_second >> 32;

  printf ("STAMP: %02d:%02d:%02d %08x`%08x\r\n",          m.hour,
          m.minute,
          m.second,
          w, v);


}