Azure IoT common library
Fork of azure_c_shared_utility by
gb_time.c@0:fa2de1b79154, 2016-04-08 (annotated)
- Committer:
- Azure.IoT Build
- Date:
- Fri Apr 08 12:01:36 2016 -0700
- Revision:
- 0:fa2de1b79154
- Child:
- 20:95abdea56064
1.0.4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Azure.IoT Build | 0:fa2de1b79154 | 1 | // Copyright (c) Microsoft. All rights reserved. |
Azure.IoT Build | 0:fa2de1b79154 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
Azure.IoT Build | 0:fa2de1b79154 | 3 | |
Azure.IoT Build | 0:fa2de1b79154 | 4 | /*depending if the symbol GB_TIME_INTERCEPT is defined, this file does the following |
Azure.IoT Build | 0:fa2de1b79154 | 5 | |
Azure.IoT Build | 0:fa2de1b79154 | 6 | a) if GB_TIME_INTERCEPT is NOT defined, then the file shall be empty (almost:) |
Azure.IoT Build | 0:fa2de1b79154 | 7 | b) if GB_TIME_INTERCEPT is defined, then the file shall call to the 'real' time.h functions from their gb_* synonyms*/ |
Azure.IoT Build | 0:fa2de1b79154 | 8 | |
Azure.IoT Build | 0:fa2de1b79154 | 9 | static const int avoid_a_warning_C4206 = 0; /* warning C4206: nonstandard extension used: translation unit is empty*/ |
Azure.IoT Build | 0:fa2de1b79154 | 10 | |
Azure.IoT Build | 0:fa2de1b79154 | 11 | #ifdef GB_TIME_INTERCEPT |
Azure.IoT Build | 0:fa2de1b79154 | 12 | |
Azure.IoT Build | 0:fa2de1b79154 | 13 | #ifdef __cplusplus |
Azure.IoT Build | 0:fa2de1b79154 | 14 | #include <ctime> |
Azure.IoT Build | 0:fa2de1b79154 | 15 | #else |
Azure.IoT Build | 0:fa2de1b79154 | 16 | #include <time.h> |
Azure.IoT Build | 0:fa2de1b79154 | 17 | #endif |
Azure.IoT Build | 0:fa2de1b79154 | 18 | |
Azure.IoT Build | 0:fa2de1b79154 | 19 | #include "azure_c_shared_utility/gb_time.h" |
Azure.IoT Build | 0:fa2de1b79154 | 20 | |
Azure.IoT Build | 0:fa2de1b79154 | 21 | /*this is time*/ |
Azure.IoT Build | 0:fa2de1b79154 | 22 | time_t gb_time(time_t *timer); |
Azure.IoT Build | 0:fa2de1b79154 | 23 | { |
Azure.IoT Build | 0:fa2de1b79154 | 24 | return time(timer); |
Azure.IoT Build | 0:fa2de1b79154 | 25 | } |
Azure.IoT Build | 0:fa2de1b79154 | 26 | |
Azure.IoT Build | 0:fa2de1b79154 | 27 | /*this is localtime*/ |
Azure.IoT Build | 0:fa2de1b79154 | 28 | struct tm *gb_localtime(const time_t *timer) |
Azure.IoT Build | 0:fa2de1b79154 | 29 | { |
Azure.IoT Build | 0:fa2de1b79154 | 30 | return gb_localtime(timer); |
Azure.IoT Build | 0:fa2de1b79154 | 31 | } |
Azure.IoT Build | 0:fa2de1b79154 | 32 | |
Azure.IoT Build | 0:fa2de1b79154 | 33 | size_t gb_strftime(char * s, size_t maxsize, const char * format, const struct tm * timeptr) |
Azure.IoT Build | 0:fa2de1b79154 | 34 | { |
Azure.IoT Build | 0:fa2de1b79154 | 35 | return strftime(s, maxsize, format, timeptr); |
Azure.IoT Build | 0:fa2de1b79154 | 36 | } |
Azure.IoT Build | 0:fa2de1b79154 | 37 | |
Azure.IoT Build | 0:fa2de1b79154 | 38 | #endif |