Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
4e990b47
Commit
4e990b47
authored
Mar 28, 2022
by
Rob Swindell
💬
Browse files
Add minutes_to_str() function
Generates a "Dd Hh Mm" string from a specified number of minutes.
parent
e635293c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
src/sbbs3/date_str.c
src/sbbs3/date_str.c
+10
-0
src/sbbs3/date_str.h
src/sbbs3/date_str.h
+2
-1
No files found.
src/sbbs3/date_str.c
View file @
4e990b47
...
...
@@ -131,6 +131,16 @@ char* seconds_to_str(uint seconds, char* str)
return
p
;
}
/* Returns a duration in minutes into a string */
char
*
minutes_to_str
(
uint
min
,
char
*
str
,
size_t
size
)
{
safe_snprintf
(
str
,
size
,
"%ud %uh %um"
,
min
/
(
24
*
60
)
,(
min
%
(
24
*
60
))
/
60
,
min
%
60
);
return
str
;
}
/****************************************************************************/
/****************************************************************************/
char
*
hhmmtostr
(
scfg_t
*
cfg
,
struct
tm
*
tm
,
char
*
str
)
...
...
src/sbbs3/date_str.h
View file @
4e990b47
...
...
@@ -39,8 +39,9 @@ DLLEXPORT char * sectostr(uint sec, char *str);
DLLEXPORT
char
*
seconds_to_str
(
uint
,
char
*
);
DLLEXPORT
char
*
hhmmtostr
(
scfg_t
*
cfg
,
struct
tm
*
tm
,
char
*
str
);
DLLEXPORT
char
*
timestr
(
scfg_t
*
cfg
,
time32_t
intime
,
char
*
str
);
DLLEXPORT
char
*
minutes_to_str
(
uint
min
,
char
*
str
,
size_t
);
#ifdef __cplusplus
}
#endif
#endif
/* Don't add anything after this line */
\ No newline at end of file
#endif
/* Don't add anything after this line */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment