[Icecast] [patch] time stamps in dump file names
Jochen Friedrich
jochen
Sun Jun 6 14:43:09 UTC 2004
Hi,
this patch enables the use of time stamps in dump file names:
diff -ur icecast-2.0.1/src/source.c icecast-2.0.1.scram/src/source.c
--- icecast-2.0.1/src/source.c Wed May 12 17:55:30 2004
+++ icecast-2.0.1.scram/src/source.c Wed Jun 2 23:17:29 2004
@@ -50,6 +50,16 @@
http_parser_t *parser, const char *mount, format_type_t type,
mount_proxy *mountinfo)
{
+ char buffer[PATH_MAX];
+ time_t curtime;
+ struct tm *loctime;
+
+ /* Get the current time. */
+ curtime = time (NULL);
+
+ /* Convert it to local time representation. */
+ loctime = localtime (&curtime);
+
source_t *src;
src = (source_t *)malloc(sizeof(source_t));
@@ -76,7 +86,8 @@
src->fallback_mount = strdup (mountinfo->fallback_mount);
src->max_listeners = mountinfo->max_listeners;
if (mountinfo->dumpfile != NULL)
- src->dumpfilename = strdup (mountinfo->dumpfile);
+ strftime (buffer, PATH_MAX, mountinfo->dumpfile, loctime);
+ src->dumpfilename = strdup (buffer);
}
if(src->dumpfilename != NULL) {
Example:
<dump-file>/tmp/ewire-%Y%m%d-%H%M%S.mp3</dump-file>
--jochen
More information about the Icecast
mailing list