Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 28-07-2018, 08:11   #1
Registered User

Join Date: Jun 2018
Posts: 17
Next Tide Event Time

I'm not quite sure how to explain this...


The "Next tide event" column in route properties is calculating incorrectly for me.


I have "Time shown as" set to "Local @ PC". The next tide event column is, however, showing the next tide event AFTER local time + 7 hours. It appears to be treating UTC as local time, since I am UTC-7.


Does that make sense?
__________________

SerialHobbyist is offline   Reply With Quote
Old 28-07-2018, 10:03   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Serial...

What is your location/tide station?

Dave
__________________

bdbcat is offline   Reply With Quote
Old 28-07-2018, 10:45   #3
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Serial...

More info needed. Screenshots, route info, etc....

Thanks
Dave
bdbcat is offline   Reply With Quote
Old 29-07-2018, 09:04   #4
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

http://floogle.net/Screenshot2018-07-29.png

This shows the next tide event should be the low tide @ 11:40, however the route properties is showing the next event as the high tide @ 19:24.


Additionally, I modified the code to subtract a magic number of 7 hours (I'm at UTC-7) and it then displays the correct tide event info.
SerialHobbyist is offline   Reply With Quote
Old 29-07-2018, 16:00   #5
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Serial...

This is indeed a bug. The logic to calculate the next BigEvent at a tide station is flawed, becoming offset by the local time zone.

Will be fixed in the next release.

Thanks for the catch
Dave
bdbcat is offline   Reply With Quote
Old 29-07-2018, 17:18   #6
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

I really wanted to submit a fix for it, but I'm not familiar enough with the code yet and I'm not sure how best to get the user's timezone. I think the value tz passed into RouteProp::MakeTideInfo with a value of 1 is specifying it should be in "pc local" time, right?
SerialHobbyist is offline   Reply With Quote
Old 29-07-2018, 18:32   #7
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Serial....

Close. This issue was that GetNextBigEvent() should be called with local time, not UTC.

Try this code, which is the commit I will push when I get back to master branch again.

Code:
wxString RouteProp::MakeTideInfo( int jx, time_t tm, int tz_selection, long LMT_Offset )
{
    int ev = 0;
    wxString tide_form;
    
    // tm comes in as UTC...
    // convert to local time for GetNextBigEvent
    wxDateTime now = wxDateTime::Now();
    wxDateTime nowutc = wxDateTime::Now().MakeUTC();
    time_t t_off = now.GetTicks() - nowutc.GetTicks();
    
    wxDateTime dtmu;
    dtmu.Set( tm + t_off );

    time_t dtmtt = dtmu.GetTicks();
    
    if( gpIDX ) {
        ev = ptcmgr->GetNextBigEvent( &dtmtt,
                ptcmgr->GetStationIDXbyName( wxString( gpIDX->IDX_station_name, wxConvUTF8 ),
                        gpIDX->IDX_lat, gpIDX->IDX_lon ) );
    } else
        ev = ptcmgr->GetNextBigEvent( &dtmtt, jx );

    //convert event time back to UTC
    wxDateTime dtm;
    dtm.Set( dtmtt ).MakeUTC(); 
    
    if( ev == 1 ) tide_form.Printf( _T("LW: ") );
    if( ev == 2 ) tide_form.Printf( _T("HW: ") );
    
    tide_form.Append( ts2s( dtm, tz_selection, LMT_Offset, DISPLAY_FORMAT ) );
    if( !gpIDX ) {
        wxString locn( ptcmgr->GetIDX_entry( jx )->IDX_station_name, wxConvUTF8 );
        tide_form.Append( _T(" @~~") );
        tide_form.Append( locn );
    }
    return ( tide_form );
}
Dave
bdbcat is offline   Reply With Quote
Old 30-07-2018, 07:51   #8
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

Makes sense.


But, am I overcomplicating things, or doesn't it need to take into account whether the user has selected "UTC", "local @ PC", or "LMT"?


I guess I was assuming that it originally worked correctly for UTC.
SerialHobbyist is offline   Reply With Quote
Old 30-07-2018, 08:50   #9
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Serial...

The user tz selection is only about what is displayed, and is handled by
ts2s() parameters..

But try it out, and let me know how it works in the various options.
This TZ stuff always leaves me head-scratching......

Dave
bdbcat is offline   Reply With Quote
Old 31-07-2018, 09:17   #10
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

I quickly tested your code change and it fixed my UTC-7 problem, and using the UTC setting also seems to work correctly with it.


I don't understand the use-case for LMT, so I didn't test it.
SerialHobbyist is offline   Reply With Quote
Old 01-08-2018, 00:48   #11
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 259
Re: Next Tide Event Time

I often wondered what to expect in the route manager in the "next tide event" column. Is there any specific setting to be made to get these values calculated/shown.
Have also tried with the otcurrent_pi

In the manual I didnt find anything related.

Was looking for some recalculate or update option to plan a route with route manager and then finally activate it and get it updated on the way.

To show tidal information in the route plan would be really great.
skipperearly is offline   Reply With Quote
Old 01-08-2018, 06:48   #12
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,956
Re: Next Tide Event Time

Skipper...

If you do two things, the column is populated.

1. Before opening route manager, open the graphic for a specific tide station. This will be the location for which "next tide event" is calculated.

2. Open the route manager. Fill in a value for "departure time", and hit return.

The next event column will then be populated.

Dave
bdbcat is offline   Reply With Quote
Old 01-08-2018, 07:37   #13
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

Also, if you set the waypoint name in a special way, you can "tie" the waypoint to a specific tide station.


To do so, open the waypoint properties and change the name of the waypoint to include the special characters "@~~" immediately followed by the tide station name (or at least a unique beginning to the tide station name -- it will match the first tide station that begins with those characters). e.g. "001 @~~Port Townsend (Point Hudson), Washington" You still need to set a "Departure time" before the column will be populated.



Unfortunately, this does not work for current stations, which would be much more useful for me. I sail in the San Juan and Gulf Islands of the Pacific Northwest and it's an unusual day that the currents would not be an issue.


I'm currently testing a patch that does show the current data. However this method of modifying the waypoint name seems a bit of a hack -- I'd rather it was a more obvious and usable feature.


Chas
SerialHobbyist is offline   Reply With Quote
Old 03-08-2018, 07:11   #14
Registered User

Join Date: Feb 2012
Location: Austria
Posts: 259
Re: Next Tide Event Time

@SerialHobbyist thanks for this info - great feature and it works!
Got a bit confused with the date and time format and assume it works only with UTC flawlessly.
Only snag when printing the route the tide event column cannot be selected to get printed - and starting date/time doesn't get remembered.
skipperearly is offline   Reply With Quote
Old 07-08-2018, 16:39   #15
Registered User

Join Date: Jun 2018
Posts: 17
Re: Next Tide Event Time

Yes, trying to use local PC time currently has a bug -- which started this thread.


I'm seeing the Departure Time randomly disappearing and I'm looking for what might cause it. It's really "bugging" me...


Chas
__________________

SerialHobbyist is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCpn Tide time 1 hour out silentwings39 OpenCPN 24 25-04-2016 04:37
OpenCPN Route Planning with Time and Tide PjotrC OpenCPN 14 28-11-2011 13:11
Time and Tide Clocks sailormoon Navigation 17 04-10-2011 13:45
Implementing Routeplan Time & Tide in 0324 Beta PjotrC OpenCPN 8 14-05-2011 13:34
Tide and time. mudnut Navigation 14 25-04-2007 15:04

Advertise Here


All times are GMT -7. The time now is 02:33.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2020, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.