Search code examples
can-buscaplcanoe

unable to print date and time in canoe logs?


is there any way to print date and time for each log in canoe ??? example: right now for me its printing like below

"8754.876831   CAN 1   AAA   YYYY   CAN Frame    Tx     8     8             00 00 00 00 00 00 00 00"

i would like to have like below

"09 OCT 2017 14:17:23.853 CAN 1   AAA   YYYY   CAN Frame    Tx     8     8             00 00 00 00 00 00 00 00"

is there any way to print like above in canoe ????


Solution

  • Try this:

    on key 'l'
    {
      long tm[9];
    
      getLocalTime(tm);
    
      write("seconds:%d minutes:%d hours:%d day:%d month:%d year:%d",tm[0],tm[1],tm[2],tm[3],tm[4]+1,tm[5]+1900);
    }