]> git.sur5r.net Git - freertos/blob - FreeRTOS-Labs/Source/FreeRTOS-Plus-FAT/include/ff_time.h
Add the Labs projects provided in the V10.2.1_191129 zip file.
[freertos] / FreeRTOS-Labs / Source / FreeRTOS-Plus-FAT / include / ff_time.h
1 /*\r
2  * FreeRTOS+FAT build 191128 - Note:  FreeRTOS+FAT is still in the lab!\r
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  * Authors include James Walmsley, Hein Tibosch and Richard Barry\r
5  *\r
6  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
7  * this software and associated documentation files (the "Software"), to deal in\r
8  * the Software without restriction, including without limitation the rights to\r
9  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
10  * the Software, and to permit persons to whom the Software is furnished to do so,\r
11  * subject to the following conditions:\r
12  *\r
13  * The above copyright notice and this permission notice shall be included in all\r
14  * copies or substantial portions of the Software.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * https://www.FreeRTOS.org\r
24  *\r
25  */\r
26 \r
27 /**\r
28  *      @file           ff_time.h\r
29  *      @ingroup        TIME\r
30  *\r
31  *      Provides a means for receiving the time on any platform.\r
32  **/\r
33 \r
34 #ifndef _FF_TIME_H_\r
35 #define _FF_TIME_H_\r
36 \r
37 #include <time.h>\r
38 \r
39 #include "FreeRTOSFATConfig.h"\r
40 \r
41 /* _HT_\r
42 The following declarations and functions may be moved to a common directory?\r
43  */\r
44 typedef struct xTIME_STRUCT\r
45 {\r
46         int tm_sec;   /* Seconds */\r
47         int tm_min;   /* Minutes */\r
48         int tm_hour;  /* Hour (0--23) */\r
49         int tm_mday;  /* Day of month (1--31) */\r
50         int tm_mon;   /* Month (0--11) */\r
51         int tm_year;  /* Year (calendar year minus 1900) */\r
52         int tm_wday;  /* Weekday (0--6; Sunday = 0) */\r
53         int tm_yday;  /* Day of year (0--365) */\r
54         int tm_isdst; /* 0 if daylight savings time is not in effect) */\r
55 } FF_TimeStruct_t;\r
56 \r
57 /* Equivalent of time() : returns the number of seconds after 1-1-1970. */\r
58 time_t FreeRTOS_time( time_t *pxTime );\r
59 \r
60 /* Equivalent of mktime() : calculates the number of seconds after 1-1-1970. */\r
61 time_t FreeRTOS_mktime( const FF_TimeStruct_t *pxTimeBuf );\r
62 \r
63 /* Equivalent of gmtime_r() : Fills a 'struct tm'. */\r
64 FF_TimeStruct_t *FreeRTOS_gmtime_r( const time_t *pxTime, FF_TimeStruct_t *pxTimeBuf );\r
65 \r
66 /**\r
67  *      @public\r
68  *      @brief  A TIME and DATE object for FreeRTOS+FAT. A FreeRTOS+FAT time driver must populate these values.\r
69  *\r
70  **/\r
71 typedef struct\r
72 {\r
73         uint16_t Year;          /* Year (e.g. 2009). */\r
74         uint16_t Month;         /* Month        (e.g. 1 = Jan, 12 = Dec). */\r
75         uint16_t Day;           /* Day  (1 - 31). */\r
76         uint16_t Hour;          /* Hour (0 - 23). */\r
77         uint16_t Minute;        /* Min  (0 - 59). */\r
78         uint16_t Second;        /* Second       (0 - 59). */\r
79 } FF_SystemTime_t;\r
80 \r
81 /*---------- PROTOTYPES */\r
82 \r
83 int32_t FF_GetSystemTime(FF_SystemTime_t *pxTime);\r
84 \r
85 #endif\r
86 \r