unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* current-time-zone
@ 2003-12-19 23:59 gebser
  0 siblings, 0 replies; 3+ messages in thread
From: gebser @ 2003-12-19 23:59 UTC (permalink / raw)



Should "M-x current-time-zone" return something?  Using emacs v.20.7.1
all get in the minibuffer is "[No match]".  However, "C-h f 
current-time-zone" shows:

<snip>
current-time-zone is a built-in function.

Return the offset and name for the local time zone.
This returns a list of the form (OFFSET NAME).
OFFSET is an integer number of seconds ahead of UTC (east of Greenwich).
    A negative value means west of Greenwich.
NAME is a string giving the name of the time zone.
If an argument is given, it specifies when the time zone offset is 
determined
instead of using the current time.  The argument should have the form:
  (HIGH . LOW)
or the form:
  (HIGH LOW . IGNORED).
Thus, you can use times obtained from `current-time'
and from `file-attributes'.

Some operating systems cannot provide all this information to Emacs;
in this case, `current-time-zone' returns a list containing nil for
the data it can't find.

(current-time-zone &optional SPECIFIED-TIME)
</snip>

I'm thinking that, for some reason, this function isn't getting the info 
it needs from the system... which is strange because I know that $TZ is 
set.  Bug?  Workaround?  What?


tnx,
ken

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: current-time-zone
       [not found] <mailman.396.1071882284.868.help-gnu-emacs@gnu.org>
@ 2003-12-20  0:19 ` Jesper Harder
  2003-12-22 19:12   ` current-time-zone Kevin Rodgers
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Harder @ 2003-12-20  0:19 UTC (permalink / raw)


gebser@speakeasy.net writes:

> Should "M-x current-time-zone" return something?  Using emacs v.20.7.1
> all get in the minibuffer is "[No match]".

`current-time-zone' is not an interactive function.  You can't call it
with `M-x'.

You can do `M-: (current-time-zone)' or eval it from the scratch
buffer.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: current-time-zone
  2003-12-20  0:19 ` current-time-zone Jesper Harder
@ 2003-12-22 19:12   ` Kevin Rodgers
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2003-12-22 19:12 UTC (permalink / raw)


Jesper Harder wrote:

> gebser@speakeasy.net writes:
>>Should "M-x current-time-zone" return something?  Using emacs v.20.7.1
>>all get in the minibuffer is "[No match]".
>>
> 
> `current-time-zone' is not an interactive function.  You can't call it
> with `M-x'.

But you can if you do this:


(defadvice current-time-zone (around interactive activate)
   "If called interactively, display the result in the echo area (and
append to the *Messages* buffer).  If a prefix arg is specified, prompt
for SPECIFIED-TIME."
   (interactive (list (if current-prefix-arg
			 (let ((now (decode-time (current-time))))
			   (encode-time (string-to-number
					 (read-string "Year: "
						      (format "%d"
                                                               (nth 5 now))))
					(string-to-number
					 (read-string "Month: "
						      (format "%d"
                                                               (nth 4 now))))
					(string-to-number
					 (read-string "Day: "
						      (format "%d"
                                                               (nth 3 now))))
					(string-to-number
					 (read-string "Hour: "
						      (format "%d"
                                                               (nth 2 now))))
					(string-to-number
					 (read-string "Minutes: "
						      (format "%d"
                                                               (nth 1 now))))
					(string-to-number
					 (read-string "Seconds: "
						      (format "%d"
                                                               (nth 0 now)))))))))
   ad-do-it
   (if (interactive-p)
       (message "%s" ad-return-value)
     ad-return-value))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-12-22 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.396.1071882284.868.help-gnu-emacs@gnu.org>
2003-12-20  0:19 ` current-time-zone Jesper Harder
2003-12-22 19:12   ` current-time-zone Kevin Rodgers
2003-12-19 23:59 current-time-zone gebser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).