DCF77.h and Time.h incompatibility

Two years ago I made a sketch for the domotica of a house, off grid, off internet, in the middle of the woods.
With several temperature, humidty and other monitors, I needed a decent time stamp, reason to add a DCF77 receiver, with its library and also the TIME library.
(Info for who lives outside Europe: DCF77 is a sender in Frankfurt, Germany that broadcasts accurate time signals over long wave).
Everything worked perfect, but because I want to add a C02 meter from Adafruit/Sensirion I needed to modify and re-upload the sketch.
There the problems occured:
I get several "exit status 1messages.

  • 'time_t time' redeclared as different kind of symbol
    -Sometimes but not always I get : 'Error compiling for board Arduino Mega or Mega 2560
    -'setTime' was not declared in this scope
    -'now' was not declared in this scope
    'day' was not declared in this scope
    and so on for month and year...
    Seems like the contents of Time.h and Time.cpp is not known by the builder/compiler
    My actual version of the IDE is 1.8.20 Hourly Build 2021/12/20 07:34

So I tried to isolate the problem by making a new user in my computer (MacBookPro11,4 with OSX 11.6), installing an old Arduino IDE version 1.8.12, totaly isolated from my main development system.
I downloaded the library DCF77 and Verify/Compiled an example sketch included in the library "InternalClockSyns".
I did not get a complaint because the libray Time.h was not loaded in the library folder. This allows to conclude that the Time.h is included or built inside the IDE or Arduino15. To be clear, DFC77 was the one and only folder inside the library folder and Time.h is not included in the DCF library.
Buit all the exit alarms remain exactly the same.
I replaced the Mega2560 by a Uno, but no difference.
It would not be wise to try to fiddle inside Time.h and Time.cpp because it's part of the contents of the very application, IDE or Arduino15

There is not much I can do myself, because I use an ready cooked example of a library that worked very well when I build my sketch 2 years ago but not today. I did not add or remove a line of code in the example sketch.
Question: What is different today compared to 2 years ago and how to solve this.

Activate verbose compiler output in the preferences of the IDE. The IDE will tell you which Time.h library it uses.
In my IDE I don't have a Time.h file in the default installation. I don't know if you have activated case sensitivity for the filesystem of your MacBook because there are quite some time.h files in the default installation...

I am on verbose output. I will check if there is a difference with or without case sensitivity.
I am quite sure there is some Time. header in either Arduino15 or the IDE, reason not to bother about its correctness.

The IDE tells you for every library used which version from which path it uses. What does it say about the Time.h library?

At some point in time, the Time library renamed Time.h to TimeLib.h, the cpp file is still Time.cpp

< edit >
The filename was possibly changed in order to distinguish it from time.h on operating systems that do not distinguish between upper and lower case letters.

I am on verbose output.
I found the libraries included in the Arduino appl., inside /contents/java/libraries but there is no Time lib there, nor in Arduino15
The problem lies (most probably) with the fact that at least 3 different Time libraries circulate.
-There is a Time library with a Time.h file that only contains :#include TimeLib.h"

  • Presumably the oldest one has a full blown Time.h file on board.
  • A third library is called "Time_master" it contains "TimeLib.h" and "Time.cpp" but not a "Time.h".
    The problem is that, with the exmples inside the DCf77 library, an #include TimeLib.h is done, but the builder/compiler responds with all sort of problems.
    When I replace "#include Time h" with "#include TimeLib.h# I get a "Error compiling for Arduino Mega" and the same when I try with a Uno or an Arduino Ethernet.
    Though, the #include TimeLib.h should be a valid statement because the examples from the Time_master library use it.
    I am running out of possibilities.
    I start wondering which programmer I should use. May be I changed this inadvertently. I use genuine Arduino 1.8.20

Then tell us which path the compiler uses for the Time.h library. In the verbose output it tells you which option it had and which it chose.
If you're unable to find it yourself, post complete output.

There is no Arduino IDE 1.8.20. The newest stable version is 1.8.19. The release candidate versions are in the 2.0 line.

The java libraries are not of interest here.

To answer some questions from pylon questions, I did some tests.
I took some time to unlock this problem. The conclusion is rather surpising.
But first some answers : The version of my IDE i definitly 1.8.20 Hourly build2021/12/20 07:34, as mention in "About Arduino" and in the headers of the windows.
As told I made a new user with only Arduino, Arduino15, a sketchbook and a Library folder.
In the Library folder I only put the DCF77 lib, and one at a time the different versions of Time lib.
In the first test I use theTime.lib, that has a Time.h with the only contents : "#include TimeLib.h".
In the builder output this Time.h was identified as Time.h v 1.6.1
At first id did not recognize the Time.header.
Under the sketch menu there is an item that says: INCLUDE LIBRARY.
I opened it to check if the IDE really saw that Time library; it did.
So I selected the library and in the sketch appeared a line "include <TimeLib.h>" with TIMELIB in orange.
When I checked and uploaded teh sketch, everything was ok.
Though the builder wrote that it had selected. "Time.h v1.6.1" not TimeLib.h
Thus when I use only my own handwritten “#include <Time.h>”, the builder doesn’t even mention Time.h or equivalent in the output.
Using the INCLUDE LIBRARY menu item, it yields clearly :

"Alternatives for TimeLib.h: [Time@1.6.1]
ResolveLibrary(TimeLib.h)
-> candidates: [Time@1.6.1]"

And then bit lower in the text.

"Using library Time at version 1.6.1 in folder: /Users/Marianne/Documents/mySketchbook/libraries/Time"

Using Time-Master library, nothing never works, in the output there no word about it.
Using library Time-1.6.0 the same happens as with Time. 1.6.1. with the expetion that, with the Menu item "INCLUDE LIBRARY", two items are added in the sketch: "include <Time.h>" with Time.h in black AND #Include <TimeLib.H>" with Time.h in orange.

So it seems that, whie the IDE interface is expectd to be apure text application, whenthe IDE ass something, that someting is handled slightly differently.
But Time-Master library IS NOT WORKING WELL.
Anyway may many thanks for your reamrks and help.
I learned a lot in the mean time.

Better to run the latest release version if you are a new user, the daily builds may contains some software patches that are still in the process of being fully tested and may themselves introduce some odd software bugs.

TimeLib.h is in fact the file to include the Time library by Paul Stoffregen (which can be installed in the IDE using the Library Manager). That particular library does have the unusual structure of not using the actual library name for the header file, for reasons I've given in previous posts. The current version is 1.6.1

Time.h on your system is likely including the time.h file, part of a standard library, the likely cause of the IDE not mentioning which library it has included. On my computer, all I get is an error message that Time.h is not found, because the file names are case-sensitive.

Not sure where the Time-Master library comes from - one of the major problems with libraries for the IDE is that there is no coordination of file names. This can lead to long searches trying to find exactly which library an older code uses, particularly if the needed library no longer exists.

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