This repository was archived by the owner on Sep 11, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathtime.h
More file actions
71 lines (58 loc) · 2.05 KB
/
Copy pathtime.h
File metadata and controls
71 lines (58 loc) · 2.05 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// time.h
/*
This file is part of Tripover, a broad-search journey planner.
Copyright (C) 2014-2015 Joris van der Geer.
*/
#define Epochyear 2000
#define Epoch 20000101
// 1-1-2000 = sat
#define Epochwday 5
// time horizon
#define Erayear 2020
#define Era 20200101
#define Era1 20191231
// c11 langage only
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201101
_Static_assert(Epochyear > 1969,"time before 1970 not handled");
_Static_assert(Epochyear < 2100,"time after 2100 not handled");
_Static_assert(Epochyear < Erayear,"must have a time span");
_Static_assert(Erayear - Epochyear < 100,"time span too large");
_Static_assert(Erayear > Epochyear,"time span too small");
#endif
#define lmin2min(lmin,utcofs) lmin2minfln(FLN,(lmin),(utcofs))
static inline ub4 lmin2mini(ub4 lmin,ub4 utcofs)
{
if (lmin < utcofs) return lmin;
else if (lmin == utcofs) return 0;
else if (utcofs < 12 * 60) return lmin + (12 * 60 - utcofs);
else if (utcofs > 12 * 60) return lmin - (utcofs - 12 * 60);
else return lmin;
}
#define cd2day(c) cd2dayfln(FLN,(c))
#define day2cd(c) day2cdfln(FLN,(c))
extern ub4 gettime_sec(void);
extern ub8 gettime_msec(void);
extern ub8 thrtime_usec(void);
extern int setimer(ub4 msec,bool virtual);
extern int setthtimer(ub4 tid,ub4 msec);
extern int rmthtimer(ub4 tid);
extern int isexpired(ub4 tid);
extern int isalarm(void);
extern int epochrange(ub4 fln,ub4 cd,const char *name);
extern ub4 epochlim(ub4 day);
extern ub4 sec70toyymmdd(ub4 secs,ub4 prec,char *dst,ub4 dstlen);
extern ub4 yymmdd2min(ub4 cd,ub4 utcofs);
extern ub4 lmin2cd(ub4 min);
extern ub4 min2wday(ub4 min);
extern ub4 min2lmin(ub4 min,ub4 utcofs);
extern ub4 min2llmin(ub4 min,ub4 utcofs,ub4 locofs,ub4 dstonof);
extern ub4 lmin2minfln(ub4 fln,ub4 lmin,ub4 utcofs);
extern ub4 utc12ofs(ub4 uo12);
extern ub4 cdday2wday(ub4 cd);
extern ub4 cd2dayfln(ub4 fln,ub4 cd);
extern ub1 indst(ub4 t,ub4 dstonof);
extern ub4 day2cdfln(ub4 fln,ub4 day);
extern ub4 hhmm2min(ub4 ct);
extern ub4 nix2min(ub4 xmin);
extern void initime(int iter);
extern void exitime(void);