877 |
time_t now = time(NULL); |
time_t now = time(NULL); |
878 |
struct tm *tm_now = localtime(&now); |
struct tm *tm_now = localtime(&now); |
879 |
char now_str[32]; |
char now_str[32]; |
880 |
strftime(now_str, sizeof(now_str)-1, "%F_%H:%M", tm_now); |
strftime(now_str, sizeof(now_str)-1, "%F_%H-%M", tm_now); |
881 |
char *fname = g_strdup_printf(appdata->fieldnotes_path, now_str); |
char *fname = g_strdup_printf(appdata->fieldnotes_path, now_str); |
882 |
|
|
883 |
printf("--- about to export logs to %s ---\n", fname); |
printf("--- about to export logs to %s ---\n", fname); |
884 |
FILE *file = fopen(fname, "w"); |
FILE *file = fopen(fname, "w"); |
885 |
g_free(fname); |
g_free(fname); |
886 |
|
|
887 |
if(file) { |
if(file) { |
|
|
|
888 |
llog = log; |
llog = log; |
889 |
while(llog) { |
while(llog) { |
890 |
printf("Exporting %s\n", llog->cache->id); |
printf("Exporting %s\n", llog->cache->id); |
974 |
} |
} |
975 |
|
|
976 |
fclose(file); |
fclose(file); |
977 |
} |
} else |
978 |
|
errorf(_("Can't open file:\n\n%s"), strerror(errno)); |
979 |
|
|
980 |
} else { |
} else { |
981 |
/* restore old path, in case it has been altered but not been used */ |
/* restore old path, in case it has been altered but not been used */ |
982 |
free(appdata->fieldnotes_path); |
free(appdata->fieldnotes_path); |