PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Time
libdatetime
dt_toEt.c
1
/*
2
dt_toEt.c
3
4
Ported from Bob Belleville's date_time_epoch.spin from
5
http://obex.parallax.com/object/191
6
7
Copyright (c) Parallax Inc 2015. All rights MIT licensed;
8
see end of file.
9
*/
10
11
#include "
simpletools.h
"
12
#include "
datetime.h
"
13
14
//int dte_toETV(int y, int mo, int d,int h,int m, int s)
15
int
dt_toEt
(
datetime
dt)
16
{
17
// create a epoch time value for the given date and time
18
return
( (dte_toJD(dt.y,dt.mo,dt.d) - _epoch) * 86400 )
19
+ dte_toSPD(dt.h,dt.m,dt.s);
20
}
21
22
/*
23
TERMS OF USE: MIT License
24
25
Permission is hereby granted, free of charge, to any person obtaining a
26
copy of this software and associated documentation files (the "Software"),
27
to deal in the Software without restriction, including without limitation
28
the rights to use, copy, modify, merge, publish, distribute, sublicense,
29
and/or sell copies of the Software, and to permit persons to whom the
30
Software is furnished to do so, subject to the following conditions:
31
32
The above copyright notice and this permission notice shall be included in
33
all copies or substantial portions of the Software.
34
35
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
41
DEALINGS IN THE SOFTWARE.
42
*/
43
dt_toEt
int dt_toEt(datetime dt)
Get the Unix epoch time (number of seconds from Midnight, 1/1/1970) from a datetime type....
Definition:
dt_toEt.c:15
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
datetime.h
This library provides convenient functions for a variety of timekeeping operations....
datetime_st
datetime_st Structure containing y, mo, h, m, and s elements.
Definition:
datetime.h:56
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17