mess822x
1.23
mess822x
Loading...
Searching...
No Matches
mess822x-1.23
src
caldate_fmt.c
Go to the documentation of this file.
1
#include "
caldate.h
"
2
3
unsigned
int
caldate_fmt
(
char
*s,
struct
caldate
*cd)
4
{
5
long
x;
6
int
i = 0;
7
8
x = cd->
year
;
if
(x < 0) x = -x;
do
{ ++i; x /= 10; }
while
(x);
9
10
if
(s) {
11
x = cd->
year
;
12
if
(x < 0) { x = -x; *s++ =
'-'
; }
13
s += i;
do
{ *--s =
'0'
+ (x % 10); x /= 10; }
while
(x); s += i;
14
15
x = cd->
month
;
16
s[0] =
'-'
; s[2] =
'0'
+ (x % 10); x /= 10; s[1] =
'0'
+ (x % 10);
17
18
x = cd->
day
;
19
s[3] =
'-'
; s[5] =
'0'
+ (x % 10); x /= 10; s[4] =
'0'
+ (x % 10);
20
}
21
22
return
(cd->
year
< 0) + i + 6;
23
}
caldate.h
caldate_fmt
unsigned int caldate_fmt(char *s, struct caldate *cd)
Definition:
caldate_fmt.c:3
caldate
Definition:
caldate.h:4
caldate::day
int day
Definition:
caldate.h:7
caldate::year
long year
Definition:
caldate.h:5
caldate::month
int month
Definition:
caldate.h:6
Generated on Mon Mar 3 2025 20:48:08 for mess822x by
1.9.6