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
Michael Smith
2004-Aug-06 14:57 UTC
[Icecast-dev] Re: [Icecast] [patch] time stamps in dump file names
On Monday 07 June 2004 07:43, Jochen Friedrich wrote:> Hi, > > this patch enables the use of time stamps in dump file names:Wouldn't it be better to make this conditional (on some other config file setting)? Not everyone wants this - but I suppose if they don't have % signs embedded in the filename it'll work as before. I'd accept (and commit) this with the following changes: - Documentation! Absolute requirement. - Check the return value from strftime(), and deal with that case appropriately. Mike p.s. This is better suited to the icecast-dev list - please follow up there.
Karl Heyes
2004-Aug-06 14:57 UTC
[Icecast-dev] Re: [Icecast] [patch] time stamps in dump file names
<200406151403.05629.msmith@xiph.org> Message-ID: <1087305291.2933.11.camel@bogus.hackers.club> On Tue, 2004-06-15 at 05:03, Michael Smith wrote:> On Monday 07 June 2004 07:43, Jochen Friedrich wrote: > > Hi, > > > > this patch enables the use of time stamps in dump file names: > > Wouldn't it be better to make this conditional (on some other config file > setting)? Not everyone wants this - but I suppose if they don't have % signs > embedded in the filename it'll work as before. > > I'd accept (and commit) this with the following changes: > - Documentation! Absolute requirement. > - Check the return value from strftime(), and deal with that case > appropriately.also localtime is not thread safe. localtime_r really should be used. karl.