#include <errno.h>
#include <signal.h>
#include <getopt.h>
+#include <time.h>
#include "overlay.h"
#include "chart.h"
return 500000;
}
+static void overlay_snapshot(struct overlay_context *ctx)
+{
+ char buf[1024];
+ sprintf(buf, "/tmp/overlay-snapshot-%ld.png", (long)time(NULL));
+ cairo_surface_write_to_png(ctx->surface, buf);
+}
+
int main(int argc, char **argv)
{
static struct option long_options[] = {
overlay_show(ctx.surface);
if (take_snapshot) {
- char buf[80];
- sprintf(buf, "overlay-snapshot-%d.png", i-1);
- cairo_surface_write_to_png(ctx.surface, buf);
+ overlay_snapshot(&ctx);
take_snapshot = 0;
}