/src/imagemagick/MagickCore/timer-private.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization |
3 | | dedicated to making software imaging solutions freely available. |
4 | | |
5 | | You may not use this file except in compliance with the License. You may |
6 | | obtain a copy of the License at |
7 | | |
8 | | https://imagemagick.org/script/license.php |
9 | | |
10 | | Unless required by applicable law or agreed to in writing, software |
11 | | distributed under the License is distributed on an "AS IS" BASIS, |
12 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | See the License for the specific language governing permissions and |
14 | | limitations under the License. |
15 | | |
16 | | MagickCore private timer methods. |
17 | | */ |
18 | | #ifndef MAGICKCORE_TIMER_PRIVATE_H |
19 | | #define MAGICKCORE_TIMER_PRIVATE_H |
20 | | |
21 | | #if defined(__cplusplus) || defined(c_plusplus) |
22 | | extern "C" { |
23 | | #endif |
24 | | |
25 | | #include "MagickCore/locale_.h" |
26 | | |
27 | | static inline void GetMagickUTCTime(const time_t *timep,struct tm *result) |
28 | 1.29M | { |
29 | 1.29M | #if defined(MAGICKCORE_HAVE_GMTIME_R) |
30 | 1.29M | (void) gmtime_r(timep,result); |
31 | | #elif defined(_MSC_VER) |
32 | | (void) gmtime_s(result,timep); |
33 | | #else |
34 | | { |
35 | | struct tm |
36 | | *my_time; |
37 | | |
38 | | my_time=gmtime(timep); |
39 | | if (my_time != (struct tm *) NULL) |
40 | | (void) memcpy(result,my_time,sizeof(*my_time)); |
41 | | } |
42 | | #endif |
43 | 1.29M | } Unexecuted instantiation: animate.c:GetMagickUTCTime Unexecuted instantiation: blob.c:GetMagickUTCTime Unexecuted instantiation: cache.c:GetMagickUTCTime Unexecuted instantiation: cipher.c:GetMagickUTCTime Unexecuted instantiation: constitute.c:GetMagickUTCTime Unexecuted instantiation: display.c:GetMagickUTCTime Unexecuted instantiation: fx.c:GetMagickUTCTime Unexecuted instantiation: identify.c:GetMagickUTCTime Unexecuted instantiation: image.c:GetMagickUTCTime Unexecuted instantiation: log.c:GetMagickUTCTime Unexecuted instantiation: magick.c:GetMagickUTCTime Unexecuted instantiation: module.c:GetMagickUTCTime Unexecuted instantiation: policy.c:GetMagickUTCTime Unexecuted instantiation: random.c:GetMagickUTCTime Unexecuted instantiation: registry.c:GetMagickUTCTime Unexecuted instantiation: resource.c:GetMagickUTCTime Unexecuted instantiation: signature.c:GetMagickUTCTime Line | Count | Source | 28 | 1.29M | { | 29 | 1.29M | #if defined(MAGICKCORE_HAVE_GMTIME_R) | 30 | 1.29M | (void) gmtime_r(timep,result); | 31 | | #elif defined(_MSC_VER) | 32 | | (void) gmtime_s(result,timep); | 33 | | #else | 34 | | { | 35 | | struct tm | 36 | | *my_time; | 37 | | | 38 | | my_time=gmtime(timep); | 39 | | if (my_time != (struct tm *) NULL) | 40 | | (void) memcpy(result,my_time,sizeof(*my_time)); | 41 | | } | 42 | | #endif | 43 | 1.29M | } |
Line | Count | Source | 28 | 593 | { | 29 | 593 | #if defined(MAGICKCORE_HAVE_GMTIME_R) | 30 | 593 | (void) gmtime_r(timep,result); | 31 | | #elif defined(_MSC_VER) | 32 | | (void) gmtime_s(result,timep); | 33 | | #else | 34 | | { | 35 | | struct tm | 36 | | *my_time; | 37 | | | 38 | | my_time=gmtime(timep); | 39 | | if (my_time != (struct tm *) NULL) | 40 | | (void) memcpy(result,my_time,sizeof(*my_time)); | 41 | | } | 42 | | #endif | 43 | 593 | } |
Unexecuted instantiation: dpx.c:GetMagickUTCTime Line | Count | Source | 28 | 868 | { | 29 | 868 | #if defined(MAGICKCORE_HAVE_GMTIME_R) | 30 | 868 | (void) gmtime_r(timep,result); | 31 | | #elif defined(_MSC_VER) | 32 | | (void) gmtime_s(result,timep); | 33 | | #else | 34 | | { | 35 | | struct tm | 36 | | *my_time; | 37 | | | 38 | | my_time=gmtime(timep); | 39 | | if (my_time != (struct tm *) NULL) | 40 | | (void) memcpy(result,my_time,sizeof(*my_time)); | 41 | | } | 42 | | #endif | 43 | 868 | } |
Unexecuted instantiation: pdb.c:GetMagickUTCTime Unexecuted instantiation: pdf.c:GetMagickUTCTime Unexecuted instantiation: ps2.c:GetMagickUTCTime Unexecuted instantiation: ps3.c:GetMagickUTCTime Unexecuted instantiation: ps.c:GetMagickUTCTime Unexecuted instantiation: xps.c:GetMagickUTCTime Unexecuted instantiation: png.c:GetMagickUTCTime |
44 | | |
45 | | static inline void GetMagickLocaltime(const time_t *timep,struct tm *result) |
46 | 0 | { |
47 | 0 | #if defined(MAGICKCORE_HAVE_GMTIME_R) |
48 | 0 | (void) localtime_r(timep,result); |
49 | 0 | #elif defined(_MSC_VER) |
50 | 0 | (void) localtime_s(result,timep); |
51 | 0 | #else |
52 | 0 | { |
53 | 0 | struct tm |
54 | 0 | *my_time; |
55 | 0 |
|
56 | 0 | my_time=localtime(timep); |
57 | 0 | if (my_time != (struct tm *) NULL) |
58 | 0 | (void) memcpy(result,my_time,sizeof(*my_time)); |
59 | 0 | } |
60 | 0 | #endif |
61 | 0 | } Unexecuted instantiation: animate.c:GetMagickLocaltime Unexecuted instantiation: blob.c:GetMagickLocaltime Unexecuted instantiation: cache.c:GetMagickLocaltime Unexecuted instantiation: cipher.c:GetMagickLocaltime Unexecuted instantiation: constitute.c:GetMagickLocaltime Unexecuted instantiation: display.c:GetMagickLocaltime Unexecuted instantiation: fx.c:GetMagickLocaltime Unexecuted instantiation: identify.c:GetMagickLocaltime Unexecuted instantiation: image.c:GetMagickLocaltime Unexecuted instantiation: log.c:GetMagickLocaltime Unexecuted instantiation: magick.c:GetMagickLocaltime Unexecuted instantiation: module.c:GetMagickLocaltime Unexecuted instantiation: policy.c:GetMagickLocaltime Unexecuted instantiation: random.c:GetMagickLocaltime Unexecuted instantiation: registry.c:GetMagickLocaltime Unexecuted instantiation: resource.c:GetMagickLocaltime Unexecuted instantiation: signature.c:GetMagickLocaltime Unexecuted instantiation: timer.c:GetMagickLocaltime Unexecuted instantiation: cin.c:GetMagickLocaltime Unexecuted instantiation: dpx.c:GetMagickLocaltime Unexecuted instantiation: mat.c:GetMagickLocaltime Unexecuted instantiation: pdb.c:GetMagickLocaltime Unexecuted instantiation: pdf.c:GetMagickLocaltime Unexecuted instantiation: ps2.c:GetMagickLocaltime Unexecuted instantiation: ps3.c:GetMagickLocaltime Unexecuted instantiation: ps.c:GetMagickLocaltime Unexecuted instantiation: xps.c:GetMagickLocaltime Unexecuted instantiation: png.c:GetMagickLocaltime |
62 | | |
63 | | extern MagickExport MagickBooleanType |
64 | | IsSourceDataEpochSet(void); |
65 | | |
66 | | extern MagickExport time_t |
67 | | GetMagickTime(void); |
68 | | |
69 | | static inline MagickBooleanType IsImageTTLExpired(const Image* image) |
70 | 465M | { |
71 | 465M | if (image->ttl == (time_t) 0) |
72 | 465M | return(MagickFalse); |
73 | 0 | return(image->ttl < GetMagickTime() ? MagickTrue : MagickFalse); |
74 | 465M | } Unexecuted instantiation: animate.c:IsImageTTLExpired Unexecuted instantiation: blob.c:IsImageTTLExpired cache.c:IsImageTTLExpired Line | Count | Source | 70 | 465M | { | 71 | 465M | if (image->ttl == (time_t) 0) | 72 | 465M | return(MagickFalse); | 73 | 0 | return(image->ttl < GetMagickTime() ? MagickTrue : MagickFalse); | 74 | 465M | } |
Unexecuted instantiation: cipher.c:IsImageTTLExpired Unexecuted instantiation: constitute.c:IsImageTTLExpired Unexecuted instantiation: display.c:IsImageTTLExpired Line | Count | Source | 70 | 35.3k | { | 71 | 35.3k | if (image->ttl == (time_t) 0) | 72 | 35.3k | return(MagickFalse); | 73 | 0 | return(image->ttl < GetMagickTime() ? MagickTrue : MagickFalse); | 74 | 35.3k | } |
Unexecuted instantiation: identify.c:IsImageTTLExpired Unexecuted instantiation: image.c:IsImageTTLExpired Unexecuted instantiation: log.c:IsImageTTLExpired Unexecuted instantiation: magick.c:IsImageTTLExpired Unexecuted instantiation: module.c:IsImageTTLExpired Unexecuted instantiation: policy.c:IsImageTTLExpired Unexecuted instantiation: random.c:IsImageTTLExpired Unexecuted instantiation: registry.c:IsImageTTLExpired Unexecuted instantiation: resource.c:IsImageTTLExpired Unexecuted instantiation: signature.c:IsImageTTLExpired Unexecuted instantiation: timer.c:IsImageTTLExpired Unexecuted instantiation: cin.c:IsImageTTLExpired Unexecuted instantiation: dpx.c:IsImageTTLExpired Unexecuted instantiation: mat.c:IsImageTTLExpired Unexecuted instantiation: pdb.c:IsImageTTLExpired Unexecuted instantiation: pdf.c:IsImageTTLExpired Unexecuted instantiation: ps2.c:IsImageTTLExpired Unexecuted instantiation: ps3.c:IsImageTTLExpired Unexecuted instantiation: ps.c:IsImageTTLExpired Unexecuted instantiation: xps.c:IsImageTTLExpired Unexecuted instantiation: png.c:IsImageTTLExpired |
75 | | |
76 | | static inline time_t ParseMagickTimeToLive(const char *time_to_live) |
77 | 0 | { |
78 | 0 | char |
79 | 0 | *q; |
80 | |
|
81 | 0 | time_t |
82 | 0 | ttl; |
83 | | |
84 | | /* |
85 | | Time to live, absolute or relative, e.g. 1440, 2 hours, 3 days, ... |
86 | | */ |
87 | 0 | ttl=(time_t) InterpretLocaleValue(time_to_live,&q); |
88 | 0 | if (q != time_to_live) |
89 | 0 | { |
90 | 0 | while (isspace((int) ((unsigned char) *q)) != 0) |
91 | 0 | q++; |
92 | 0 | if (LocaleNCompare(q,"second",6) == 0) |
93 | 0 | ttl*=1; |
94 | 0 | if (LocaleNCompare(q,"minute",6) == 0) |
95 | 0 | ttl*=60; |
96 | 0 | if (LocaleNCompare(q,"hour",4) == 0) |
97 | 0 | ttl*=3600; |
98 | 0 | if (LocaleNCompare(q,"day",3) == 0) |
99 | 0 | ttl*=86400; |
100 | 0 | if (LocaleNCompare(q,"week",4) == 0) |
101 | 0 | ttl*=604800; |
102 | 0 | if (LocaleNCompare(q,"month",5) == 0) |
103 | 0 | ttl*=2628000; |
104 | 0 | if (LocaleNCompare(q,"year",4) == 0) |
105 | 0 | ttl*=31536000; |
106 | 0 | } |
107 | 0 | return(ttl); |
108 | 0 | } Unexecuted instantiation: animate.c:ParseMagickTimeToLive Unexecuted instantiation: blob.c:ParseMagickTimeToLive Unexecuted instantiation: cache.c:ParseMagickTimeToLive Unexecuted instantiation: cipher.c:ParseMagickTimeToLive Unexecuted instantiation: constitute.c:ParseMagickTimeToLive Unexecuted instantiation: display.c:ParseMagickTimeToLive Unexecuted instantiation: fx.c:ParseMagickTimeToLive Unexecuted instantiation: identify.c:ParseMagickTimeToLive Unexecuted instantiation: image.c:ParseMagickTimeToLive Unexecuted instantiation: log.c:ParseMagickTimeToLive Unexecuted instantiation: magick.c:ParseMagickTimeToLive Unexecuted instantiation: module.c:ParseMagickTimeToLive Unexecuted instantiation: policy.c:ParseMagickTimeToLive Unexecuted instantiation: random.c:ParseMagickTimeToLive Unexecuted instantiation: registry.c:ParseMagickTimeToLive Unexecuted instantiation: resource.c:ParseMagickTimeToLive Unexecuted instantiation: signature.c:ParseMagickTimeToLive Unexecuted instantiation: timer.c:ParseMagickTimeToLive Unexecuted instantiation: cin.c:ParseMagickTimeToLive Unexecuted instantiation: dpx.c:ParseMagickTimeToLive Unexecuted instantiation: mat.c:ParseMagickTimeToLive Unexecuted instantiation: pdb.c:ParseMagickTimeToLive Unexecuted instantiation: pdf.c:ParseMagickTimeToLive Unexecuted instantiation: ps2.c:ParseMagickTimeToLive Unexecuted instantiation: ps3.c:ParseMagickTimeToLive Unexecuted instantiation: ps.c:ParseMagickTimeToLive Unexecuted instantiation: xps.c:ParseMagickTimeToLive Unexecuted instantiation: png.c:ParseMagickTimeToLive |
109 | | |
110 | | extern MagickPrivate void |
111 | | SetMagickDatePrecision(const unsigned long); |
112 | | |
113 | | #if defined(__cplusplus) || defined(c_plusplus) |
114 | | } |
115 | | #endif |
116 | | |
117 | | #endif |