FireBirdLib - Topfield TMS PVR TAP Programming Library
AddSec.c
Go to the documentation of this file.
1
#include "
libFireBird.h
"
2
3
dword
AddSec
(dword date,
byte
dateSec,
int
add)
4
{
5
TRACEENTER
();
6
7
word mjd;
8
int
hour, min, sec;
9
dword ret;
10
11
mjd =
MJD
(date);
12
hour=
HOUR
(date);
13
min =
MINUTE
(date);
14
sec = dateSec;
15
16
sec += add % 60;
17
18
if
(sec < 0) min -= 1;
19
else
if
(sec > 59) min += 1;
20
21
add /= 60;
22
23
min += add % 60;
24
25
if
(min < 0)
26
{
27
hour -= 1;
28
min += 60;
29
}
30
else
if
(min > 59)
31
{
32
hour += 1;
33
min -= 60;
34
}
35
36
hour += add / 60;
37
38
if
(hour < 0)
39
{
40
mjd -= 1;
41
hour += 24;
42
}
43
else
if
(hour > 23)
44
{
45
mjd += 1;
46
hour -= 24;
47
}
48
ret =
DATE
(mjd, hour, min);
49
50
TRACEEXIT
();
51
return
ret;
52
}
AddSec
dword AddSec(dword date, byte dateSec, int add)
Definition:
AddSec.c:3
libFireBird.h
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
MINUTE
#define MINUTE(d)
Definition:
libFireBird.h:2706
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
DATE
#define DATE(mjd, h, m)
Definition:
libFireBird.h:2702
HOUR
#define HOUR(d)
Definition:
libFireBird.h:2705
MJD
#define MJD(d)
Definition:
libFireBird.h:2703
time
AddSec.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3