return ret;
}
+
+gchar *
+cr_append_pid_and_datetime(const char *str, const char *suffix)
+{
+ GDateTime *cur_datetime = g_date_time_new_now_local();
+ gchar *datetime = g_date_time_format(cur_datetime, "%Y%m%d%H%M%S");
+ gchar *result = g_strdup_printf("%s%jd.%s.%d%s",
+ str ? str : "",
+ (intmax_t) getpid(),
+ datetime,
+ g_date_time_get_microsecond(cur_datetime),
+ suffix ? suffix : "");
+ g_free(datetime);
+ g_date_time_unref(cur_datetime);
+ return result;
+}
} cr_RmFlags;
/** Wrapper over rm command
- * @param path Path (supports wildcards)
+ * @param path Path (supports wildcards)
* @param flags Flags
* @param working_dir Working directory
* @param err GError **
cr_RmFlags flags,
const char *working_dir,
GError **err);
+
+/** Append "YYYYmmddHHMMSS.MICROSECONDS.PID" suffix to the str.
+ * @param str String or NULL
+ * @param suffix Another string that will be appended or NULL
+ * @param return Newly allocated string
+ */
+gchar *
+cr_append_pid_and_datetime(const char *str, const char *suffix);
/** @} */
#ifdef __cplusplus