Time lib error on code that compiled before?

Hi, I built a device to pressure test equipment to see if it will leak underwater and it has work great but now i am building a few more and my same code will not compile due to an error in the Time Lib.
Anyone out there familiar with the time lib and can help?

this is the error message i am getting when i try and compile.
Compiling sketch...

"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs" "-IC:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master" "-IC:\Users\Greg\Documents\LTSketchbook\libraries\Time-master" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" "-IC:\Users\Greg\Documents\LTSketchbook\libraries\SparkFun_MS5803-14BA_Breakout_Arduino_Library-master\src" "C:\Users\Greg\AppData\Local\Temp\arduino_build_135141\sketch\P-TESTER-V2rev2.03.ino.cpp" -o "C:\Users\Greg\AppData\Local\Temp\arduino_build_135141\sketch\P-TESTER-V2rev2.03.ino.cpp.o"
In file included from C:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master/MegunoLink.h:6:0,
from C:\Users\Greg\Desktop\P-TESTER-V2\P_TESTER-V2.2\FIRMWARE 2.03\P-TESTER-V2rev2.03\P-TESTER-V2rev2.03.ino:7:
C:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master/utility/TimePlot.h:90:50: error: 'tm' has not been declared
void SetCursorPosition(const char* SeriesName, tm &Time);
^~
C:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master/utility/TimePlot.h:91:65: error: 'tm' has not been declared
void SetCursorPosition(const __FlashStringHelper* SeriesName, tm& Time);
^~
Multiple libraries were found for "CommandHandler.h"
Used: C:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master
Not used: C:\Users\Greg\Documents\LTSketchbook\libraries\MegunoLink
Multiple libraries were found for "TimeLib.h"
Used: C:\Users\Greg\Documents\LTSketchbook\libraries\Time-master
Not used: C:\Users\Greg\Documents\LTSketchbook\libraries\Time
Using library MLP-master at version 1.30 in folder: C:\Users\Greg\Documents\LTSketchbook\libraries\MLP-master
Using library Time-master at version 1.5 in folder: C:\Users\Greg\Documents\LTSketchbook\libraries\Time-master
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Using library SparkFun_MS5803-14BA_Breakout_Arduino_Library-master at version 1.1.2 in folder: C:\Users\Greg\Documents\LTSketchbook\libraries\SparkFun_MS5803-14BA_Breakout_Arduino_Library-master
exit status 1
Error compiling for board Arduino Pro or Pro Mini.

Unless you post the sketch, it will be hard to find the problem. Please don't forget to use code tags when you do that.

Hi,
This forum is a community.
Those who help on this forum are volunteers and receive nothing but criticism or praise.
(or get paid if posted in the "Jobs and Paid Consultancy" category).
They often receive a lot of joy knowing that we were able to help someone, and this one expresses a lot of joy in accomplishing what alone I was not able to.

We are very happy to help you with your idea or difficulty.
But to facilitate our understanding of it, we give here a suggestion of how
you must expose:

Simply and clearly describe the idea or difficulty you are having, and
provide additional information such as:
post (using the appropriate tags </>) the sketches you are using in the project, and
make sure it is commented out and formatted;
post (using the appropriate tags </>) error printouts;
the ucontroller used in the project; ,
the schematic of the connections of the components involved in the project;
libraries link let us know how it is and which version;
drawings, photos, etc.
(Sorry for language errors, English is not my native language).

here is my sketch but the problem isnt in my sketch its in the TIME library.

// Pressure Sensor - Out of Bounds Technology
// ***************************************

#include "CommandHandler.h"
#include <TimeLib.h>
#include "MegunoLink.h"
#include <Wire.h>
#include <SparkFun_MS5803_I2C.h> // Click here to get the library: http://librarymanager/All#SparkFun_MS5803-14BA

XYPlot Myplot; 
MS5803 sensor(ADDRESS_HIGH);
InterfacePanel MyPanel;
CommandHandler<> SerialCommandHandler; 

// ***** USER CONROLLED VARIABLES ******

double Pressure_Bias = 1.03; // CHANGE THIS TO CALIBRATE THE PRESSURE SENSOR
double tplBIAS = .35;  // Adjust this variable for leek detection sensitvity,(difference peek / max loss)



//***** SYSTEM VARIABLES *****
double PEEK_PRESSURE = 0;
double Pressure_Loss;
double Start_Pressure;
double stability_timer;
double temp_F, temp_c, Base_Pressure;
double pressure_abs = 0;
double pressure_psi = 0; 
double Pressure_Average[3];
double timer = 0;
double avg_bar = 0;
double SET_TIMER = 30;
double Set_Time;
double tpLOSS = 0;
double stableDIFF = 0;
double TOTALDIFF = 0; 
int start = 0;
int y = 0;
int x = 0;
int Y1 = 1;
int Y2 = 7;

void setup() {
  // Start your preferred I2C object
  Wire.begin();
  
  //Initialize Serial Monitor
  Serial.begin(9600);
 
  //Retrieve calibration constants for conversion math.
  sensor.reset();
  sensor.begin();

  

READ_SETUP_PRESSURE(); 
SETUP_XYPLOT();
SETUP_DISPLAY();
}






void loop() {
SerialCommandHandler.Process(); 
READ_PRESSURE();
tpLOSS = (PEEK_PRESSURE - avg_bar);




// +++++++++++++UPDATED DISPLAY READINGS ++++++++++
      Myplot.SendData("BAR", timer, avg_bar); // Display the graph

      MyPanel.SetText(F("DynamicLabel11"), timer);
      MyPanel.SetText(F("DynamicLabel2"), avg_bar);      // Display BAR pressure
      MyPanel.SetText(F("DynamicLabel4"), pressure_psi); // Display PSI pressure
      MyPanel.SetText(F("DynamicLabel5"), temp_c);
      MyPanel.SetText(F("DynamicLabel6"), temp_F);
      MyPanel.SetText(F("DynamicLabel12"), tpLOSS ); 
      

   if (x == 1){  
 
      TOTALDIFF = (tpLOSS - stableDIFF);
      
      MyPanel.SetText(F("DynamicLabel15"), TOTALDIFF); 
      
      if (TOTALDIFF <= .03){
         MyPanel.SetBackColor(F("DynamicLabel15"), F("Green")); 
      }
      if (TOTALDIFF > .03){
         MyPanel.SetBackColor(F("DynamicLabel15"), F("Orange")); 
      } 

      if (TOTALDIFF > .04){
         MyPanel.SetBackColor(F("DynamicLabel15"), F("Red")); 
      }

         
   }

//   +++++++ Is there pressure ?  ++++++++
if (avg_bar > 1)
{

  if (start == 0){
     setTime(0,0,0,0,0,0);
     start = 1;
  }

  
  timer = (minute() + (second()*.01)); // start timer

                         //  Is pressure rising? ++++++++++++++
             if ((Pressure_Average[0] + .0005) < Pressure_Average[2])   
                    {
                     MyPanel.SetBackColor(F("DynamicLabel7"), F("Orange")); 
                     MyPanel.SetBackColor(F("DynamicLabel2"), F("Orange")); 
                     MyPanel.SetBackColor(F("DynamicLabel4"), F("Orange"));
                     MyPanel.SetText(F("DynamicLabel7"), "PRESSURIZING");
              
                    }

                     //  Is pressure stable? ++++++++++++++
  if (Pressure_Average[0] == Pressure_Average[2])
        {
           MyPanel.SetBackColor(F("DynamicLabel7"), F("Green"));
           MyPanel.SetText(F("DynamicLabel7"), "---PRESSURE STABLE---");
           MyPanel.SetBackColor(F("DynamicLabel2"), F("Green")); //
           MyPanel.SetBackColor(F("DynamicLabel4"), F("Green"));
            stability_timer++; 
                 
            if (x == 0){
                    if (stability_timer > .50)
                                {
                                 
                                  Set_Time = timer;
                                  Base_Pressure = ((sensor.getPressure(ADC_4096)*.001)- Pressure_Bias); // take pressure reading if stable for comparrison.
                                  MyPanel.SetText(F("DynamicLabel9"), Base_Pressure);
                                  stableDIFF = (PEEK_PRESSURE - Base_Pressure);
                                 MyPanel.SetText(F("DynamicLabel10"),stableDIFF);
                                  MyPanel.SetBackColor(F("DynamicLabel13"), F("Green"));
                                  MyPanel.SetText(F("DynamicLabel13"),"TESTING..." );
                                    x = 1;
                                    
                                  }
                           }
                   }


                     //  Is pressure going down? ++++++++++++++



               
  if  ((Pressure_Average[0]- .0005) > Pressure_Average[2])
{ 
       if (y == 0)
       {
         PEEK_PRESSURE = ((sensor.getPressure(ADC_4096)*.001)- Pressure_Bias);
          MyPanel.SetText(F("DynamicLabel14"),PEEK_PRESSURE);
          y = 1;
        }
                            
            if (timer < 1)  
              {
                MyPanel.SetBackColor(F("DynamicLabel2"), F("yellow")); 
                MyPanel.SetBackColor(F("DynamicLabel4"), F("Yellow"));
                MyPanel.SetBackColor(F("DynamicLabel7"), F("Yellow"));
                MyPanel.SetText(F("DynamicLabel7"), "PRESSURE STABILIZING");
               }
  else
              {
               MyPanel.SetBackColor(F("DynamicLabel2"), F("Red")); 
               MyPanel.SetBackColor(F("DynamicLabel4"), F("Red"));
               MyPanel.SetBackColor(F("DynamicLabel7"), F("Red"));
               MyPanel.SetText(F("DynamicLabel7"), "PRESSURE DROPPING");
               }
 }


if (x == 2)
{
  MyPanel.SetText(F("DynamicLabel12"), (Base_Pressure - avg_bar));
}

// ++++++++++++++++++  IS THERE A LEAK? ++++++++++++++++

if (stableDIFF > 0)
{
  if (TOTALDIFF > .04)
{
  MyPanel.SetBackColor(F("DynamicLabel8"), F("RED"));
  MyPanel.SetText(F("DynamicLabel8"), "LEAK DETECTED");
  MyPanel.SetBackColor(F("DynamicLabel13"), F("Red"));
  MyPanel.SetText(F("DynamicLabel13"),"TESTING FAILED" ); 
}
}
}
}

// +++++++++++++++++++++++  FUNCTIONS +++++++++++++++++++++

void SETUP_DISPLAY()
{

   MyPanel.SetBackColor(F("DynamicLabel5"), F("Control"));
   // MyPanel.SetText(F("DynamicLabel7"), "");
   
   MyPanel.SetBackColor(F("DynamicLabel7"), F("White"));
   MyPanel.SetText(F("DynamicLabel7"), "");
   
   MyPanel.SetBackColor(F("DynamicLabel8"), F("White"));
   MyPanel.SetText(F("DynamicLabel8"), "");
   
   MyPanel.SetBackColor(F("DynamicLabel2"), F("White")); 
   MyPanel.SetText(F("DynamicLabel12"), 0.00); 
   
   MyPanel.SetBackColor(F("DynamicLabel4"), F("White"));
   
   MyPanel.SetText(F("DynamicLabel9"), 0.00);
   
   MyPanel.SetText(F("DynamicLabel10"),0.00);
   
   MyPanel.SetBackColor(F("DynamicLabel11"), F("Control"));  
   MyPanel.SetText(F("DynamicLabel11"), "");
   
   MyPanel.SetBackColor(F("DynamicLabel13"), F("Cyan"));
   MyPanel.SetText(F("DynamicLabel13"),"WAITING" );
   MyPanel.SetText(F("DynamicLabel14"),PEEK_PRESSURE); 
   MyPanel.SetText(F("DynamicLabel12"), 0.00); 

   MyPanel.SetBackColor(F("DynamicLabel15"), F("Control"));
   MyPanel.SetText(F("DynamicLabel15"), 0.00);  
 }


void SETUP_XYPLOT()
{
   Myplot.Clear("BAR"); 
   Myplot.SetTitle("P-TESTER - V2");
   Myplot.SetXLabel("MINUTES");
   Myplot.SetYLabel("BAR");
   Myplot.SetSeriesProperties("BAR", Plot::Red, Plot::Solid, 2,Plot::NoMarker);
   Myplot.SetYRange(Y1,Y2);
   Myplot.SetY2Label("BAR");
   
   Myplot.SetXRange(0,SET_TIMER);
}

double READ_PRESSURE()
{ 
  // ++++++++++++PUT READINGS INTO AN ARRAY+++++++++++
   for (byte i = 0; i < 3; i++)
   {     
     Pressure_Average[i] = ((sensor.getPressure(ADC_4096)*.001) - Pressure_Bias);
              if (Pressure_Average[i] <= 0 )
              {
               Pressure_Average[i] = 0;
              }
 delay(300);
   }
 //  +++++++  Average the Pressure Readings ++++++++++++
avg_bar = ((Pressure_Average[0] + Pressure_Average[1] + Pressure_Average[2])/3);

 //  +++++++  Convert to PSI ++++++++++++
 pressure_psi = (avg_bar * 14.5038);


 //  +++++++  GET TEMP READINGS ++++++++++++

  temp_c = sensor.getTemperature(CELSIUS, ADC_512);
  temp_F = sensor.getTemperature(FAHRENHEIT, ADC_512);
}
  
double READ_SETUP_PRESSURE()
{
 Start_Pressure = ((sensor.getPressure(ADC_4096)*.001) - Pressure_Bias); 
    
}

I think this is a clue. Possibly, one of the other libraries you included is using a different Time library, and it's causing the conflict.

I really don't believe there is anything "wrong" with any of the Time libraries... it must be how you are using them, or how you installed them.

I use the DateTime library, I believe it supercedes the others, except on platforms that have a fully implemented Time library natively, such as ESP. If I'm programming on ESP, I use that, not any external library such as made for AVR-GCC because of how they truncated the native version.

You could temporarely make "Time-master" library disappear (move it to a usb key or something) and see if your sketch compiles.

pretty much anytime there is a library in a directory named
xxx-master like in your case Time-master
it indicates a library was installed from a zip file from github and it was installed incorrectly.

If you use the zip install function from the IDE library manager on a zip file from github the library will be installed incorrectly and can cause problems due to the potential of installing duplicate libraries with the same name especially when mixing multiple libraries or using zip install and the library manager download capabilities.
This is an issue caused the by github creating their zip files in a goofy format that includes the branch name as the name of the root directory.
The IDE could work around this but it doesn't

Also, while this "Time" / "TimeLib" library is available in the IDE library manager for downloading its name can cause issues on Windows machines.
The original name was "Time" and sketches used the header file <Time.h>
The problem is that Windows does not handle case sensitive file names.
As a result if you include <Time.h> that is the same as <time.h> and on newer platforms <time.h> is now part of the system cross compilation tools.
So on Windows things got confused.
The solution was to add a file named TimeLib.h so the user would include <TimeLib.h> and avoid the Time.h vs time.h issue.
This is a hack and was not a proper solution, the reason being that the directory for the "Time" library is still called Time even though sketches are now including <TimeLib.h>
While this can work, it is still subject to potential issues.
The IDE gives preferential treatment when the directory name of a library matches the header file basename i.e. TimeLib directory for a header named TimeLib.h
What should have happened is that the library name in the IDE library manager should have been changed to TimeLib so that it matches the header file basename for the main header TimeLib.h

The safest way to ensure that there are no issues, particularly on Windows machines, is to install the library using the IDE library manager which will put the library in a directory named Time
Then go manually rename that directory TimeLib
And in the sketch always include <TimeLib.h>

I'm guessing that if you were to remove your two Time libraries that are installed on your system and re-install it from the IDE library manager (NOT using a zip file) but let the IDE download and install it, and then after it is installed in the Time directory renaming the Time directory to TimeLib
Things will work again.

--- bill

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.