Coder Social home page Coder Social logo

PGN 126992 SystemTime about nmea2000 HOT 6 OPEN

ttlappalainen avatar ttlappalainen commented on June 26, 2024
PGN 126992 SystemTime

from nmea2000.

Comments (6)

ttlappalainen avatar ttlappalainen commented on June 26, 2024

No. The fields are sent to bus in right order. In interface they are ordered in order of necessity to have time source at the end so that it can have default value and does not need to provide by caller. I do not know how you have 15 on time source, since known value range is 0-5. Actually I think that NMEA reader should show "Not Available".

And yes, there is small erro in code, which I'll fix on next version. I do provide to reserved 0 instead of 0xf. And on listening TimeSource may get crazy values, since it does not have filter xx & 0xf.

from nmea2000.

usauerbrey avatar usauerbrey commented on June 26, 2024

Besides the order, does the NMEAReader do a conversation? If not, it shows Date an Time as 04/10/2017 and not as
SystemDate Days since 1970-01-01
SystemTime seconds since midnight
so I am unclear

from nmea2000.

ttlappalainen avatar ttlappalainen commented on June 26, 2024

NMEA Reader does the conversion. And SystemTime is UTC.

You can find example NMEA0183ToN2k under https://github.com/ttlappalainen/NMEA0183/tree/master/Examples/NMEA0183ToN2k how I use it. RMC message provides same value, so I do not need any time.h. I have also code for converting DaysSince1970 to current date.

from nmea2000.

usauerbrey avatar usauerbrey commented on June 26, 2024

Hi Timo

Thanks very much, it is always a problem with monitoring, do they give raw data or already processed data.

Uwe

from nmea2000.

usauerbrey avatar usauerbrey commented on June 26, 2024

Add question, where can I find the code for converting DaysSince1970 to current date?

from nmea2000.

ttlappalainen avatar ttlappalainen commented on June 26, 2024

Look NMEA0183Msg.cpp there is:

unsigned long tNMEA0183Msg::DaysToNMEA0183Date(unsigned long val) {
  if ( val!=NMEA0183UInt32NA  ) {
    tmElements_t tm;
    time_t t=val*SECS_PER_DAY; //daysToTime_t((val));
    breakTime(t, tm);
    val=tm.Day*10000+(tm.Month)*100+(tm.Year+1970-2000);
  }
  
  return val;
}

It converts DaysSince1970 to value ddmmyy used in NMEA0183. It uses timelib.h, which also have define for tmYearToY2k(tm.Year), which I could have use instead of (tm.Year+1970-2000). Write your own function, which returns date from tm in format you like to have.

from nmea2000.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.