[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tramp-touch doesn't mind timezone
From: |
Katsumi Yamaoka |
Subject: |
tramp-touch doesn't mind timezone |
Date: |
Thu, 15 Jun 2006 19:42:03 +0900 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
Hi,
When I copy a file from Japan to US using Tramp+ssh, the modtime
of the remote file gains 14 hours. It is because `tramp-touch'
sets the modtime expressed in Japan time to the remote file.
You will be able to reproduce it even with the local hosts by
changing the value of TZ in the shell-rc file in either host.
Here is a tiny patch to solve the problem:
2006-06-15 Katsumi Yamaoka <address@hidden> (tiny change)
* net/tramp.el (tramp-touch): Use UTC to express time.
*** tramp.el~ Thu May 11 08:20:52 2006
--- tramp.el Thu Jun 15 10:41:29 2006
***************
*** 5017,5031 ****
(defun tramp-touch (file time)
"Set the last-modified timestamp of the given file.
TIME is an Emacs internal time value as returned by `current-time'."
! (let ((touch-time (format-time-string "%Y%m%d%H%M.%S" time)))
(if (tramp-tramp-file-p file)
(with-parsed-tramp-file-name file nil
(let ((buf (tramp-get-buffer multi-method method user host)))
(unless (zerop (tramp-send-command-and-check
multi-method method user host
! (format "touch -t %s %s"
touch-time
! localname)))
(pop-to-buffer buf)
(error "tramp-touch: touch failed, see buffer `%s' for details"
buf))))
--- 5017,5032 ----
(defun tramp-touch (file time)
"Set the last-modified timestamp of the given file.
TIME is an Emacs internal time value as returned by `current-time'."
! (let ((touch-time (format-time-string "%Y%m%d%H%M.%S" time t)))
(if (tramp-tramp-file-p file)
(with-parsed-tramp-file-name file nil
(let ((buf (tramp-get-buffer multi-method method user host)))
(unless (zerop (tramp-send-command-and-check
multi-method method user host
! (format "TZ=UTC; export TZ; touch -t %s %s"
touch-time
! localname)
! t))
(pop-to-buffer buf)
(error "tramp-touch: touch failed, see buffer `%s' for details"
buf))))
- tramp-touch doesn't mind timezone,
Katsumi Yamaoka <=