From: <enl...@so...> - 2001-02-14 20:20:48
|
Enlightenment CVS committal Author : gilbertt Project : misc Module : camE Dir : misc/camE Modified Files: webcam.c Log Message: Patch from Alex Roberts <bs...@ba...> to make the archiving use a sane filename. Before the number it used would be reset when you started and stopped it on the same day, and that's not good. Now the filename has a full timestamp in it, and will always be unique. =================================================================== RCS file: /cvsroot/enlightenment/misc/camE/webcam.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- webcam.c 2001/01/03 21:03:34 1.14 +++ webcam.c 2001/02/14 20:21:29 1.15 @@ -308,7 +308,6 @@ void archive_jpeg(Imlib_Image im) { - static int num = 0; char buffer[1028]; char date[128]; time_t t; @@ -319,11 +318,12 @@ { time(&t); tm = localtime(&t); - strftime(date, 127, "%Y-%m-%d", tm); + strftime(date, 127, "%Y-%m-%d_%H%M%S", tm); + do { - snprintf(buffer, sizeof(buffer), "%s/webcam_%s_%05d.jpg", - grab_archive, date, num++); + snprintf(buffer, sizeof(buffer), "%s/webcam_%s.jpg", + grab_archive, date); } while (stat(buffer, &st) == 0); gib_imlib_save_image(im, buffer); |