PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Time
libdatetime
dt_fromDateStr.c
1
/*
2
datetime.c
3
4
Copyright (c) Parallax Inc 2015. All rights MIT licensed;
5
see end of file.
6
*/
7
8
#include "
simpletools.h
"
9
#include "
datetime.h
"
10
11
datetime
dt_fromDateStr
(
datetime
dt,
char
*s)
12
{
13
sscan
(s,
"%d/%d/%d"
,
14
&dt.mo, &dt.d, &dt.y);
15
if
(dt.y > 38) dt.y += 1900;
16
else
dt.y += 2000;
17
return
dt;
18
}
19
20
/*
21
TERMS OF USE: MIT License
22
23
Permission is hereby granted, free of charge, to any person obtaining a
24
copy of this software and associated documentation files (the "Software"),
25
to deal in the Software without restriction, including without limitation
26
the rights to use, copy, modify, merge, publish, distribute, sublicense,
27
and/or sell copies of the Software, and to permit persons to whom the
28
Software is furnished to do so, subject to the following conditions:
29
30
The above copyright notice and this permission notice shall be included in
31
all copies or substantial portions of the Software.
32
33
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39
DEALINGS IN THE SOFTWARE.
40
*/
41
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
dt_fromDateStr
datetime dt_fromDateStr(datetime dt, char *s)
Populates the y, mo, and d fields in a datetime type with value representations of the characters in ...
Definition:
dt_fromDateStr.c:11
sscan
int int int int sscan(const char *buffer, const char *fmt,...) __attribute__((format(printf
Convert formatted buffer to the "..." args.
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17