source: azure_iot_hub/trunk/azure_iothub/c-utility/inc/azure_c_shared_utility/gb_time.h@ 389

Last change on this file since 389 was 389, checked in by coas-nagasima, 5 years ago

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 1.7 KB
Line 
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
4#ifndef GB_TIME_H
5#define GB_TIME_H
6
7/*this file, if included instead of <stdio.h> has the following functionality:
81) if GB_TIME_INTERCEPT is defined then
9 a) some of the time.h symbols shall be redefined, for example: time => gb_time
10 b) all "code" using the time will actually (because of the preprocessor) call to gb_time
11 c) gb_time shall blindly call into time, thus realizing a passthrough
12
13 reason is: unittesting. time comes with the C Run Time and cannot be mocked (that is, in the global namespace cannot exist a function called time
14
152) if GB_TIME_INTERCEPT is not defined then
16 a) it shall include <time.h> => no passthrough, just direct linking.
17*/
18
19#ifndef GB_TIME_INTERCEPT
20#include <time.h>
21#else
22
23/*source level intercepting of function calls*/
24#define time time_never_called_never_implemented_always_forgotten
25#define localtime localtime_never_called_never_implemented_always_forgotten
26#define strftime strftime_never_called_never_implemented_always_forgotten
27
28#ifdef __cplusplus
29#include <ctime.h>
30extern "C"
31{
32#else
33#include <time.h>
34#endif
35
36#include "azure_c_shared_utility/umock_c_prod.h"
37
38#undef time
39#define time gb_time
40MOCKABLE_FUNCTION(, time_t, time, time_t *, timer);
41
42#undef localtime
43#define localtime gb_localtime
44MOCKABLE_FUNCTION(, struct tm *, localtime, const time_t *, timer);
45
46#undef strftime
47#define strftime gb_strftime
48MOCKABLE_FUNCTION(, size_t, strftime, char *, s, size_t, maxsize, const char *, format, const struct tm *, timeptr);
49
50
51#ifdef __cplusplus
52}
53#endif
54
55#endif /*GB_TIME_INTERCEPT*/
56
57#endif /* GB_TIME_H */
Note: See TracBrowser for help on using the repository browser.