mess822x 1.23
mess822x
Loading...
Searching...
No Matches
caltime_fmt.c
Go to the documentation of this file.
1#include "caldate.h"
2#include "caltime.h"
3
4unsigned int caltime_fmt(char *s,struct caltime *ct)
5{
6 unsigned int result;
7 long x;
8
9 result = caldate_fmt(s,&ct->date);
10
11 if (s) {
12 s += result;
13
14 x = ct->hour;
15 s[0] = ' ';
16 s[2] = '0' + (x % 10); x /= 10;
17 s[1] = '0' + (x % 10);
18 s += 3;
19
20 x = ct->minute;
21 s[0] = ':';
22 s[2] = '0' + (x % 10); x /= 10;
23 s[1] = '0' + (x % 10);
24 s += 3;
25
26 x = ct->second;
27 s[0] = ':';
28 s[2] = '0' + (x % 10); x /= 10;
29 s[1] = '0' + (x % 10);
30 s += 3;
31
32 s[0] = ' ';
33 x = ct->offset;
34 if (x < 0) { s[1] = '-'; x = -x; } else s[1] = '+';
35
36 s[5] = '0' + (x % 10); x /= 10;
37 s[4] = '0' + (x % 6); x /= 6;
38 s[3] = '0' + (x % 10); x /= 10;
39 s[2] = '0' + (x % 10);
40 }
41
42 return result + 15;
43}
unsigned int caltime_fmt(char *s, struct caltime *ct)
Definition: caltime_fmt.c:4
unsigned int caldate_fmt(char *s, struct caldate *cd)
Definition: caldate_fmt.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