Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
84871477
Commit
84871477
authored
3 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Move definition of DATE_FORMAT and TIME_FORMAT printinfo.c
parent
1df0af8b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/printinfo.c
+7
-7
7 additions, 7 deletions
app/printinfo.c
app/printinfo.h
+0
-3
0 additions, 3 deletions
app/printinfo.h
with
7 additions
and
10 deletions
app/printinfo.c
+
7
−
7
View file @
84871477
...
...
@@ -5,11 +5,14 @@
#include
<cdi.h>
#include
"cdi_uuid.h"
#include
"cdi_int.h"
#include
"printinfo.h"
#define DATE_FORMAT "%5.4d-%2.2d-%2.2d"
#define TIME_FORMAT "%2.2d:%2.2d:%2.2d"
void
datetime2str
(
int64_t
date
,
int
time
,
char
*
datetimestr
,
int
maxlen
)
{
...
...
@@ -18,8 +21,7 @@ datetime2str(int64_t date, int time, char *datetimestr, int maxlen)
int
hour
,
minute
,
second
;
cdiDecodeTime
(
time
,
&
hour
,
&
minute
,
&
second
);
const
int
len
=
sprintf
(
datetimestr
,
DATE_FORMAT
"T"
TIME_FORMAT
,
year
,
month
,
day
,
hour
,
minute
,
second
);
if
(
len
>
(
maxlen
-
1
))
fprintf
(
stderr
,
"Internal problem (%s): sizeof input string is too small!
\n
"
,
__func__
);
snprintf
(
datetimestr
,
maxlen
,
DATE_FORMAT
"T"
TIME_FORMAT
,
year
,
month
,
day
,
hour
,
minute
,
second
);
}
void
...
...
@@ -28,8 +30,7 @@ date2str(int64_t date, char *datestr, int maxlen)
int
year
,
month
,
day
;
cdiDecodeDate
(
date
,
&
year
,
&
month
,
&
day
);
const
int
len
=
sprintf
(
datestr
,
DATE_FORMAT
,
year
,
month
,
day
);
if
(
len
>
(
maxlen
-
1
))
fprintf
(
stderr
,
"Internal problem (%s): sizeof input string is too small!
\n
"
,
__func__
);
snprintf
(
datestr
,
maxlen
,
DATE_FORMAT
,
year
,
month
,
day
);
}
void
...
...
@@ -38,8 +39,7 @@ time2str(int time, char *timestr, int maxlen)
int
hour
,
minute
,
second
;
cdiDecodeTime
(
time
,
&
hour
,
&
minute
,
&
second
);
const
int
len
=
sprintf
(
timestr
,
TIME_FORMAT
,
hour
,
minute
,
second
);
if
(
len
>
(
maxlen
-
1
))
fprintf
(
stderr
,
"Internal problem (%s): sizeof input string is too small!
\n
"
,
__func__
);
snprintf
(
timestr
,
maxlen
,
TIME_FORMAT
,
hour
,
minute
,
second
);
}
const
char
*
...
...
This diff is collapsed.
Click to expand it.
app/printinfo.h
+
0
−
3
View file @
84871477
...
...
@@ -3,9 +3,6 @@
#include
<stdio.h>
#define DATE_FORMAT "%5.4d-%2.2d-%2.2d"
#define TIME_FORMAT "%2.2d:%2.2d:%2.2d"
void
datetime2str
(
int64_t
date
,
int
time
,
char
*
datetimestr
,
int
maxlen
);
void
date2str
(
int64_t
date
,
char
*
datestr
,
int
maxlen
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment