mess822x 1.23
mess822x
Loading...
Searching...
No Matches
caltime_scan.c
Go to the documentation of this file.
1#include "caltime.h"
2
3unsigned int caltime_scan(char *s,struct caltime *ct)
4{
5 char *t = s;
6 unsigned long z;
7 unsigned long c;
8 int sign;
9
10 t += caldate_scan(t,&ct->date);
11
12 while ((*t == ' ') || (*t == '\t') || (*t == 'T')) ++t;
13 z = 0; while ((c = (unsigned char) (*t - '0')) <= 9) { z = z * 10 + c; ++t; }
14 ct->hour = z;
15
16 if (*t++ != ':') return 0;
17 z = 0; while ((c = (unsigned char) (*t - '0')) <= 9) { z = z * 10 + c; ++t; }
18 ct->minute = z;
19
20 if (*t != ':')
21 ct->second = 0;
22 else {
23 ++t;
24 z = 0; while ((c = (unsigned char) (*t - '0')) <= 9) { z = z * 10 + c; ++t; }
25 ct->second = z;
26 }
27
28 while ((*t == ' ') || (*t == '\t')) ++t;
29 if (*t == '+') sign = 1; else if (*t == '-') sign = -1; else return 0;
30 ++t;
31 c = (unsigned char) (*t++ - '0'); if (c > 9) return 0; z = c;
32 c = (unsigned char) (*t++ - '0'); if (c > 9) return 0; z = z * 10 + c;
33 c = (unsigned char) (*t++ - '0'); if (c > 9) return 0; z = z * 6 + c;
34 c = (unsigned char) (*t++ - '0'); if (c > 9) return 0; z = z * 10 + c;
35 ct->offset = z * sign;
36
37 return t - s;
38}
unsigned int caldate_scan(char *s, struct caldate *cd)
Definition: caldate_scan.c:3
mess822_time t
Definition: 822date.c:19
void z(char *, char *, char *, int, int, int, int)
Definition: install.c:90
void c(char *, char *, char *, int, int, int)
Definition: install.c:46
unsigned int caltime_scan(char *s, struct caltime *ct)
Definition: caltime_scan.c:3
Definition: caltime.h:7
int hour
Definition: caltime.h:9
struct caldate date
Definition: caltime.h:8
int minute
Definition: caltime.h:10
int second
Definition: caltime.h:11
long offset
Definition: caltime.h:12