diff options
-rw-r--r-- | source3/modules/vfs_shadow_copy2.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 4770620e9f..b26bf272fe 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -42,6 +42,9 @@ 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> @@ -81,6 +84,10 @@ 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 @@ -99,6 +106,7 @@ static int vfs_shadow_copy2_debug_level = DBGC_VFS; #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 @@ -145,6 +153,13 @@ static char *shadow_copy2_snapshot_to_gmt(TALLOC_CTX *mem_ctx, } 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); @@ -437,6 +452,13 @@ static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname, /* 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); |