4) vanity naming for snapshots. Snapshots can be named in any
format compatible with str[fp]time conversions.
+ 5) time stamps in snapshot names can be represented in localtime
+ rather than UTC.
+
Module options:
shadow:snapdir = <directory where snapshots are kept>
be compatible with the conversion specifications recognized
by str[fp]time. The default value is "@GMT-%Y.%m.%d-%H.%M.%S".
+ shadow:localtime = yes/no (default is no)
+
+ This is an optional parameter that indicates whether the
+ snapshot names are in UTC/GMT or the local time.
The following command would generate a correctly formatted directory name
#define SHADOW_COPY2_DEFAULT_SORT NULL
#define SHADOW_COPY2_DEFAULT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
+#define SHADOW_COPY2_DEFAULT_LOCALTIME false
/*
make very sure it is one of our special names
}
DEBUG(10, ("shadow_copy2_snapshot_to_gmt: match %s: %s\n", fmt, name));
+ if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime",
+ SHADOW_COPY2_DEFAULT_LOCALTIME))
+ {
+ timestamp.tm_isdst = -1;
+ timestamp_t = mktime(×tamp);
+ gmtime_r(×tamp_t, ×tamp);
+ }
strftime(gmt, sizeof(gmt), SHADOW_COPY2_GMT_FORMAT, ×tamp);
return talloc_strdup(mem_ctx, gmt);
/* relpath is the remaining portion of the path after the @GMT-xxx */
+ if (lp_parm_bool(SNUM(handle->conn), "shadow", "localtime",
+ SHADOW_COPY2_DEFAULT_LOCALTIME))
+ {
+ timestamp_t = timegm(×tamp);
+ localtime_r(×tamp_t, ×tamp);
+ }
+
strftime(snapshot, MAXPATHLEN, fmt, ×tamp);
baselen = strlen(basedir);