#include <stdlib.h>
#include <string.h>
#include <libintl.h>
+#include <time.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
Gedcom_ctxt self, Gedcom_val parsed_value);
void set_xref_type(struct xref_value *xr, const char* str);
+int update_date(struct date_value** dv, struct tm* tm_ptr);
+int update_time(char** tv, struct tm* tm_ptr);
+
/* Doubly-linked list, but last rec->next is NULL (doesn't go to first rec) */
#define LINK_CHAIN_ELT(STRUCTTYPE, FIRSTVAL, VAL) \
{ \
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "utf8tools.h"
#include "gom.h"
#include "gom_internal.h"
return result;
}
+
+int update_date(struct date_value** dv, struct tm* tm_ptr)
+{
+ int result;
+ struct date_value* dval = gedcom_new_date_value(NULL);
+ dval->type = DV_NO_MODIFIER;
+ dval->date1.cal = CAL_GREGORIAN;
+ dval->date1.day = tm_ptr->tm_mday;
+ dval->date1.month = tm_ptr->tm_mon + 1;
+ dval->date1.year = tm_ptr->tm_year + 1900;
+ result = gedcom_normalize_date(DI_FROM_NUMBERS, dval);
+
+ if (result == 0) {
+ if (*dv) free(*dv);
+ *dv = dval;
+ }
+ return result;
+}
+
+int update_time(char** tv, struct tm* tm_ptr)
+{
+ char tval[16];
+ sprintf(tval, "%02d:%02d:%02d",
+ tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec);
+
+ if (gom_set_string(tv, tval))
+ return 0;
+ else
+ return 1;
+}
+
/* $Id$ */
/* $Name$ */
+#include <time.h>
#include "header.h"
#include "submission.h"
#include "submitter.h"
return &gom_header;
}
+int gom_header_update_timestamp(time_t t)
+{
+ int result = 0;
+ struct tm *tm_ptr = localtime(&t);
+ result |= update_date(&gom_header.date, tm_ptr);
+ result |= update_time(&gom_header.time, tm_ptr);
+ return result;
+}
+
int write_header(Gedcom_write_hndl hndl)
{
int result = 0;
#define __GEDCOM_GOM_H
#include "gedcom.h"
+#include <time.h>
#ifdef __cplusplus
extern "C" {
int gom_write_file(const char* file_name, int *total_conv_fails);
struct header* gom_get_header();
+int gom_header_update_timestamp(time_t t);
+
struct submission* gom_get_submission();
struct family* gom_get_first_family();