MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_ltm

Function in_ltm

tools/libutil/login_times.c:109–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108
109int
110in_ltm(const login_time_t *ltm, struct tm *tt, time_t *ends)
111{
112 int rc = 0;
113
114 if (tt != NULL) {
115 /* First, examine the day of the week */
116 if ((u_char)(0x01 << tt->tm_wday) & ltm->lt_dow) {
117 /* Convert `current' time to minute of the day */
118 u_short now = (u_short)((tt->tm_hour * 60) + tt->tm_min);
119
120 if (tt->tm_sec > 30)
121 ++now;
122 if (now >= ltm->lt_start && now < ltm->lt_end) {
123 rc = 2;
124 if (ends != NULL) {
125 /* If requested, return ending time for this period */
126 tt->tm_hour = (int)(ltm->lt_end / 60);
127 tt->tm_min = (int)(ltm->lt_end % 60);
128 *ends = mktime(tt);
129 }
130 }
131 }
132 }
133 return (rc);
134}
135
136
137int

Callers 2

in_ltFunction · 0.85
in_ltmsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected