Introduce prof_date_time_format_iso8601().
Instead of repeating the same pattern over and over, introduce a helper function that either outputs a formatted timestamp if one is given as argument or returns the current time if no argument is given. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
14
src/common.c
14
src/common.c
@@ -864,6 +864,20 @@ unique_filename_from_url(const char* url, const char* path)
|
||||
return unique_filename;
|
||||
}
|
||||
|
||||
/* This returns a timestamp formatted in ISO8601 format.
|
||||
* Either it returns the current time if `dt` is NULL, or
|
||||
* it returns the formatted time value passed in `dt`.
|
||||
*/
|
||||
gchar*
|
||||
prof_date_time_format_iso8601(GDateTime* dt)
|
||||
{
|
||||
GDateTime* dt_ = (dt == NULL) ? g_date_time_new_now_local() : dt;
|
||||
gchar* ret = g_date_time_format_iso8601(dt_);
|
||||
if (dt == NULL)
|
||||
g_date_time_unref(dt_);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* build profanity version string.
|
||||
* example: 0.13.1dev.master.69d8c1f9
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user