* Emacs Calc: converting FROM Unix Time, unrecognized time zone @ 2007-05-03 7:48 Alan 2007-05-03 17:27 ` Jay Belanger 0 siblings, 1 reply; 7+ messages in thread From: Alan @ 2007-05-03 7:48 UTC (permalink / raw) To: help-gnu-emacs I am trying to use calc to convert a vector of unix times in a tide table. When using "t-U" to convert unix time, the following error is received: Unrecognized time zone name: error I changed the time zone (Gentoo GNU/Linux) by copying the posix GMT+10 zoneinfo file over /etc/localtime. This seemed to make a difference the first time---my timezone name is a little obscure, or so I reasoned: "ChST" (I am on Saipan, N. Mariana Islands). Also, I am uncertain how to use this command to convert FROM unix time to something else. Probably the time zone error is peripheral to my main problem, which is just being able to convert a vector of a few thousand items by grabbing them from a file into calc. Thank you for any suggestions. I am still reading the Fine Manual. Alan Davis ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-03 7:48 Emacs Calc: converting FROM Unix Time, unrecognized time zone Alan @ 2007-05-03 17:27 ` Jay Belanger 2007-05-04 14:30 ` Alan 0 siblings, 1 reply; 7+ messages in thread From: Jay Belanger @ 2007-05-03 17:27 UTC (permalink / raw) To: help-gnu-emacs Alan <lngndvs@gmail.com> writes: > I am trying to use calc to convert a vector of unix times in a tide > table. When using "t-U" to convert unix time, the following error is > received: > > Unrecognized time zone name: error > > I changed the time zone (Gentoo GNU/Linux) by copying the posix GMT+10 > zoneinfo file over /etc/localtime. This seemed to make a difference > the first time---my timezone name is a little obscure, or so I > reasoned: "ChST" (I am on Saipan, N. Mariana Islands). Yes; the Calc manual (under "Time Zones") has a list of time zones it recognizes, and "ChST" is not one of them. With no other information to go on, Calc will look at the output of the "date" function to determine the time zone. You could bypass the "date" function and tell Calc the timezone by setting Calc's `TimeZone' variable. > Also, I am uncertain how to use this command to convert FROM unix time > to something else. `t U' will switch between unix time and date forms. To convert a vector of unix times into date forms, map 't U" across the vector: `V M t U' > Probably the time zone error is peripheral to my main problem, which > is just being able to convert a vector of a few thousand items by > grabbing them from a file into calc. If the items are already grabbed, then it looks like `V M t U' is what you want. Jay ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-03 17:27 ` Jay Belanger @ 2007-05-04 14:30 ` Alan 2007-05-04 15:31 ` Jay Belanger 0 siblings, 1 reply; 7+ messages in thread From: Alan @ 2007-05-04 14:30 UTC (permalink / raw) To: help-gnu-emacs On May 4, 3:27 am, Jay Belanger <jay.p.belan...@gmail.com> wrote: > If the items are already grabbed, then it looks like `V M t U' is what > you want. It worked! Ha! I would like to be able to extract only decimal hours from the date string "2007-05-05 14:30". Is this possible? I can easily do it by grabbing the minutes form and dividing by 60 in calc. Of course, a more direct approach would be helpful. I might offer that calc seems to have improved a great deal over the past 12 or 13 years. Also, the computer I am using is far and away faster and more powerful. I am now struggling with how to set the time zone variable. I guess I can use Sydney time, or GMT-10? The calc manual says: "f your system does not have a suitable `date' command, you may wish to put a `(setq var-TimeZone ...)' in your Emacs initialization file to set the time" This variable is undocumented in emacs 23.0.0 (Gentoo GNU/Linux). Thank you for the rapid response! Alan Davis ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-04 14:30 ` Alan @ 2007-05-04 15:31 ` Jay Belanger 2007-05-05 5:38 ` Alan 0 siblings, 1 reply; 7+ messages in thread From: Jay Belanger @ 2007-05-04 15:31 UTC (permalink / raw) To: help-gnu-emacs Alan <lngndvs@gmail.com> writes: ... > I would like to be able to extract only decimal hours from the date > string "2007-05-05 14:30". Is this possible? I can easily do it by > grabbing the minutes form and dividing by 60 in calc. Of course, a > more direct approach would be helpful. 't P' (`calc-date-part') will get it for you. Enter the date with algebraic notation: <2007-05-05 14:30> then, to get the hours, either `C-u 4 t P' or `t P', and then type `4' at the prompt (which will also tell you which number to type to get the date parts: `1' for year,..., `4' for hours). > I am now struggling with how to set the time zone variable. I guess > I can use Sydney time, or GMT-10? A list of values that Calc recognizes is in the "Time Zones" section of the Calc manual. Perhaps the TimeZone variable should be made customizable; for now, `s T' will take you to a buffer to set the variable, and `s p TimeZone' will store the value permanently in your calc initialization file. > The calc manual says: > "f your system does not have a suitable `date' command, you may > wish to put a `(setq var-TimeZone ...)' in your Emacs > initialization file to set the time" > > This variable is undocumented in emacs 23.0.0 (Gentoo GNU/Linux). It's not documented as an Emacs lisp variable (although I guess it should be), but it is documented as a Calc variable. It is in the variable index of the Calc manual under "TimeZone". As a Calc variable, it is "TimeZone", but to deal with it directly from elisp, you need to use `var-TimeZone'. (In general, the Calc variable `foo' corresponds to the lisp variable `var-foo'.) Jay ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-04 15:31 ` Jay Belanger @ 2007-05-05 5:38 ` Alan 2007-05-07 21:19 ` jay.p.belanger 2007-05-07 21:25 ` jay.p.belanger 0 siblings, 2 replies; 7+ messages in thread From: Alan @ 2007-05-05 5:38 UTC (permalink / raw) To: help-gnu-emacs On May 5, 1:31 am, Jay Belanger <jay.p.belan...@gmail.com> wrote: > > 't P' (`calc-date-part') will get it for you. > Enter the date with algebraic notation: > <2007-05-05 14:30> > then, to get the hours, either `C-u 4 t P' or > `t P', and then type `4' at the prompt (which will also tell you which > number to type to get the date parts: `1' for year,..., `4' for hours). This is very helpful. It gives me HH:mm. Is it possible to extract HH.xx (hours and decimals) directly? > It's not documented as an Emacs lisp variable (although I guess it > should be), but it is documented as a Calc variable. It is in the > variable index of the Calc manual under "TimeZone". As a Calc > variable, it is "TimeZone", but to deal with it directly from elisp, > you need to use `var-TimeZone'. (In general, the Calc variable `foo' > corresponds to the lisp variable `var-foo'.) As far as I can find in the calc manual, I am told to set the variable, but I have not been able to find out what is the format of the variable? For now I set GMT-10 by "s T', like this: "GMT-10". If I were to try to set ChST, the time zone more generally used on my Island, would I have to edit also "calc-forms.el? And what would I need to enter? There is no ChDT. Your replies have been of inestimable help. Thank you, Alan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-05 5:38 ` Alan @ 2007-05-07 21:19 ` jay.p.belanger 2007-05-07 21:25 ` jay.p.belanger 1 sibling, 0 replies; 7+ messages in thread From: jay.p.belanger @ 2007-05-07 21:19 UTC (permalink / raw) To: help-gnu-emacs On May 5, 12:38 am, Alan <lngn...@gmail.com> wrote: > On May 5, 1:31 am, Jay Belanger <jay.p.belan...@gmail.com> wrote: > > Enter the date with algebraic notation: > > <2007-05-05 14:30> > > then, to get the hours, either `C-u 4 t P' or > > `t P', and then type `4' at the prompt (which will also tell you which > > number to type to get the date parts: `1' for year,..., `4' for hours). > > This is very helpful. It gives me HH:mm. Is it possible to extract > HH.xx (hours and decimals) directly? Are you using `t P 9' to get HMS form, then? `t P 4' should just get you HH, not HH:mm. I don't think you can get HH.xx directly, but you could `t P 9' to get hms form, and then enter `M-x calc-from-hms' (`x', then `from-hms'). > As far as I can find in the calc manual, I am told to set the > variable [var-TimeZone], but I have not been able to find out what is the format of > the variable? > > For now I set GMT-10 by "s T', like this: > "GMT-10". If I were to try to set ChST, the time zone more generally used on my > Island, would I have to edit also "calc-forms.el? And what would I > need to enter? There is no ChDT. I suppose there should be more time zones added to `math-tzone- names'. You shouldn't edit calc-forms.el, but rather copy the value of `math-tzone-names' from that file, and the appropriate values. So it should look something like (setq math-tzone-names '(("UTC" 0 0) ... ( "YGT" 9 "YST" "YDT" ) ( "YST" 9 0 ) ( "YDT" 9 -1 ) ; Yukon ("ChST" 10 0) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Emacs Calc: converting FROM Unix Time, unrecognized time zone 2007-05-05 5:38 ` Alan 2007-05-07 21:19 ` jay.p.belanger @ 2007-05-07 21:25 ` jay.p.belanger 1 sibling, 0 replies; 7+ messages in thread From: jay.p.belanger @ 2007-05-07 21:25 UTC (permalink / raw) To: help-gnu-emacs Well, my last reply was sent prematurely. Anyhow, your .emacs should contain (setq math-tzone-names '(( "UTC" 0 0) ... ( "YGT" 9 "YST" "YDT" ) ( "YST" 9 0 ) ( "YDT" 9 -1 ) ; Yukon ("ChST" 10 0) ("ChDT" 10 -1) ("ChGT" 10 "ChST" "ChDT")) or something like that (make sure about daylight saving time). Jay ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-05-07 21:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-05-03 7:48 Emacs Calc: converting FROM Unix Time, unrecognized time zone Alan 2007-05-03 17:27 ` Jay Belanger 2007-05-04 14:30 ` Alan 2007-05-04 15:31 ` Jay Belanger 2007-05-05 5:38 ` Alan 2007-05-07 21:19 ` jay.p.belanger 2007-05-07 21:25 ` jay.p.belanger
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).