mess822x
1.23
mess822x
Loading...
Searching...
No Matches
mess822x-1.23
src
mess822_date.c
Go to the documentation of this file.
1
#include "
mess822.h
"
2
#include "stralloc.h"
3
4
static
char
*montab[12] = {
5
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
6
};
7
8
int
mess822_date
(stralloc *
out
,
mess822_time
*when)
9
{
10
long
i;
11
12
if
(!stralloc_copys(
out
,
""
))
return
0;
13
14
if
(!when->
known
)
return
1;
15
16
if
(!stralloc_catint(
out
,when->
ct
.
date
.
day
))
return
0;
17
if
(!stralloc_cats(
out
,
" "
))
return
0;
18
19
i = when->
ct
.
date
.
month
- 1;
20
if
(i < 0) i = 0;
21
if
(i > 11) i = 11;
22
if
(!stralloc_cats(
out
,montab[i]))
return
0;
23
if
(!stralloc_cats(
out
,
" "
))
return
0;
24
25
if
(!stralloc_catlong(
out
,when->
ct
.
date
.
year
))
return
0;
26
if
(!stralloc_cats(
out
,
" "
))
return
0;
27
28
if
(!stralloc_catint0(
out
,when->
ct
.
hour
,2))
return
0;
29
if
(!stralloc_cats(
out
,
":"
))
return
0;
30
if
(!stralloc_catint0(
out
,when->
ct
.
minute
,2))
return
0;
31
if
(!stralloc_cats(
out
,
":"
))
return
0;
32
if
(!stralloc_catint0(
out
,when->
ct
.
second
,2))
return
0;
33
34
if
(when->
known
== 1) {
35
if
(!stralloc_cats(
out
,
" -0000"
))
return
0;
36
}
37
else
{
38
i = when->
ct
.
offset
;
39
if
(i < 0) {
40
if
(!stralloc_cats(
out
,
" -"
))
return
0;
41
i = -i;
42
}
43
else
{
44
if
(!stralloc_cats(
out
,
" +"
))
return
0;
45
}
46
if
(!stralloc_catint0(
out
,(
int
) (i / 60),2))
return
0;
47
if
(!stralloc_catint0(
out
,(
int
) (i % 60),2))
return
0;
48
}
49
50
return
1;
51
}
out
stralloc out
Definition:
b64decode.c:12
mess822.h
mess822_date
int mess822_date(stralloc *out, mess822_time *when)
Definition:
mess822_date.c:8
caldate::day
int day
Definition:
caldate.h:7
caldate::year
long year
Definition:
caldate.h:5
caldate::month
int month
Definition:
caldate.h:6
caltime::hour
int hour
Definition:
caltime.h:9
caltime::date
struct caldate date
Definition:
caltime.h:8
caltime::minute
int minute
Definition:
caltime.h:10
caltime::second
int second
Definition:
caltime.h:11
caltime::offset
long offset
Definition:
caltime.h:12
mess822_time
Definition:
mess822.h:7
mess822_time::known
int known
Definition:
mess822.h:9
mess822_time::ct
struct caltime ct
Definition:
mess822.h:8
Generated on Mon Mar 3 2025 20:48:08 for mess822x by
1.9.6