Date: Thu, 18 Aug 2011 18:18:42 +0400 From: Test Rat <ttsestt@gmail.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/159874: [patch] sysutils/zfs-snapshot-mgmt: respect local timezone in offsets Message-ID: <86zkj69519.fsf@gmail.com> Resent-Message-ID: <201108181420.p7IEK7K4097775@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 159874 >Category: ports >Synopsis: [patch] sysutils/zfs-snapshot-mgmt: respect local timezone in offsets >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Aug 18 14:20:07 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Test Rat >Release: FreeBSD 9.0-CURRENT amd64 >Organization: >Environment: >Description: POSIX time is stored in seconds since the Epoch the Epoch (00:00:00 UTC, January 1, 1970) without timezone difference. As now_minutes (Time.now.to_i) are in UTC so is `offset'. This is not intuitive as snapshot timestamps tank@auto-2011-08-17_16.00 are encoded in local time, not in UTC. So, apply local timezone difference to offsets when deciding what to preserve. from http://forums.freebsd.org/showthread.php?t=25717 >How-To-Repeat: $ TZ=UTC ruby19 -e 'print Time.now.to_i' 1313564400 $ TZ=Japan/Tokyo ruby19 -e 'print Time.now.to_i' 1313564400 $ TZ=UTC ruby19 -e 'print Time.mktime(2011,8,17,16,0).to_i / 60' 21893280 $ TZ=Asia/Tokyo ruby19 -e 'print Time.mktime(2011,8,17,16,0).to_i / 60' 21892740 >Fix: --- a.diff begins here --- Index: sysutils/zfs-snapshot-mgmt/files/patch-zfs-snapshot-mgmt =================================================================== RCS file: /a/.csup/ports/sysutils/zfs-snapshot-mgmt/files/patch-zfs-snapshot-mgmt,v retrieving revision 1.1 diff -u -p -r1.1 patch-zfs-snapshot-mgmt --- sysutils/zfs-snapshot-mgmt/files/patch-zfs-snapshot-mgmt 11 Jan 2010 03:42:14 -0000 1.1 +++ sysutils/zfs-snapshot-mgmt/files/patch-zfs-snapshot-mgmt 17 Aug 2011 18:13:47 -0000 @@ -1,5 +1,14 @@ ---- zfs-snapshot-mgmt~ -+++ zfs-snapshot-mgmt +--- zfs-snapshot-mgmt.orig 2011-08-17 00:15:42.801630764 +0400 ++++ zfs-snapshot-mgmt 2011-08-17 00:20:17.751629671 +0400 +@@ -44,7 +44,7 @@ class Rule + def initialize(args = {}) + args = { 'offset' => 0 }.merge(args) + @at_multiple = args['at_multiple'].to_i +- @offset = args['offset'].to_i ++ @offset = args['offset'].to_i - $utc_offset + end + + def condition_met?(time_minutes) @@ -154,7 +154,11 @@ class FSInfo end @@ -12,3 +21,11 @@ end private +@@ -194,6 +198,7 @@ class Config + + end + ++$utc_offset = Time.now.utc_offset / 60 + config_yaml = File.open(CONFIG_FILE_NAME).read(CONFIG_SIZE_MAX) + die "Config file too long" if config_yaml.nil? + config = Config.new(YAML::load(config_yaml)) --- a.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86zkj69519.fsf>