Author Topic: Local time from calculate()  (Read 1815 times)

0 Members and 1 Guest are viewing this topic.

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 1255
    • View Profile
Local time from calculate()
« on: March 26, 2023, 03:29:02 PM »
Hi Jean - I'm trying to fix some of the bugs in medieval traditional chart. For the prenatal syzygy chart I need to find the date and time of the new or full moon prior to birth. I can get this ok with:

` find time of syzygy in julian date format
  if (zeroSun[MOON] < 180)
     jdSyz = searchaspect(chartJD - 16, chartJD, SUN, MOON, 0); ` conjunction
  else
      jdSyz = searchaspect(chartJD - 16, chartJD, SUN, MOON, 5); ` opposition

This correctly gives me the julian date of the lunation. However, I'm stuck here because I can't convert the jd to local time. The following just doesn't seem to return the correct zone for the place.

syzZone = gettimezone(place, jdSyz);
juliantotime(jdSyz + syzZone, syzTime); ` make local time

I've taken these two lines from the searchaspect() help that I used to identify the jd of the lunation.

The zone returned is either 0 or -1, when it should be much greater as the place I am using is Shanghai. (The place is correctly identified from the natal chart.)

Any help would be appreciated. Ed

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1313
    • View Profile
Re: Local time from calculate()
« Reply #1 on: March 26, 2023, 03:53:19 PM »
I've used shanghai in the test script, i get 0.33333 as zone.
Either that place is not ok or the jd is messed up.
Does the place have a number at the end to identify time zone? Shanghai is timezone 271.
Greetings from Groningen Netherlands.

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 1255
    • View Profile
Re: Local time from calculate()
« Reply #2 on: March 26, 2023, 04:50:10 PM »
Hi Jean - yes - I've got that through split(). It is the fifth variable. Can this be used. I'm trying to work out how.

I'm afraid I can't get any of the other methods to work at all - gettimezone(), gethoroscopetimezone(), etc.

Ed

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 1255
    • View Profile
Re: Local time from calculate()
« Reply #3 on: March 26, 2023, 04:55:48 PM »
I had the 271 figure, but now I can't work out how I did it. How frustrating, I found that number and now I can't recreate how I did.

I'm stumped Jean - I just can't find the zone at all.

Ed

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1313
    • View Profile
Re: Local time from calculate()
« Reply #4 on: March 26, 2023, 05:05:53 PM »
Ed see help for getplace to get that timezone, it's the last flag.
Greetings from Groningen Netherlands.

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1313
    • View Profile
Re: Local time from calculate()
« Reply #5 on: March 26, 2023, 05:09:12 PM »
It's a bit hectic here, Sindy is reporting a very hard to find bug too. Better take this up in mail?
Greetings from Groningen Netherlands.

ABer

  • Administrator
  • Hero Member
  • *****
  • Posts: 1255
    • View Profile
Re: Local time from calculate()
« Reply #6 on: March 26, 2023, 05:16:07 PM »
Hi Jean - it's probably something I'm doing but I can't find the problem. Ed

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1313
    • View Profile
Re: Local time from calculate()
« Reply #7 on: March 26, 2023, 05:23:37 PM »
Can you send me a little script that demonstrates the problem and let's go to email with this.
It would be handy if we could chat somehow.
Greetings from Groningen Netherlands.

Jean

  • Administrator
  • Hero Member
  • *****
  • Posts: 1313
    • View Profile
Re: Local time from calculate()
« Reply #8 on: March 26, 2023, 05:32:22 PM »
I modified medieval trad. chart, on line 2342 i inserted this:

Code: [Select]
  int planetaryHour = planetaryhour(r0, zone, lon, lat);
gethoroscopeplace(0, place, 0);
zone = gettimezone(place, chartJD);

I get 0.3333 for that shanghai chart.

However this should also work zone = gethoroscopetimezone(0);
Greetings from Groningen Netherlands.