error compiling - 'time_t time' redeclared as different kind of symbol

I am getting nuts :slightly_frowning_face: with the Arduino at the moment and I don´t know how to fix it.

I can´t compile the example sketches for DCF77.
Always getting error "'time_t time' redeclared as different kind of symbol".
NO changes are made in the sketches.

I get the error on two machines
Version 1.6.8. and 1.6.10 - already deinstalled and reinstalled - fresh c:\user\documents\arduino folder

What Do I have to do?? :o
(maybe already fixed in another thread but I havent found it.

THANKS...
SteHoub :slight_smile:

Full error text is:
InternalClockSync:28: error: 'time_t time' redeclared as different kind of symbol
time_t time;

  • ^*
    In file included from C:\Users\User\Documents\Arduino\libraries\DCF77/DCF77.h:9:0,
  • from C:\Users\User\Documents\Arduino\libraries\DCF77\examples\InternalClockSync\InternalClockSync.pde:22:*
    c:\program files\arduino\hardware\tools\avr\avr\include\time.h:122:21: note: previous declaration 'time_t time(time_t*)'
    time_t time(time_t *timer);
  • ^*

Also there is no time.h in the "program ... include folder"

Change InternalClockSync.pde line 14 from:

#include "Time.h"

to:

#include "TimeLib.h"

I've submitted a pull request to the DCF77 library repository to solve this issue: Use TimeLib.h instead of Time.h by per1234 · Pull Request #3 · thijse/Arduino-DCF77 · GitHub

Hello,
I have the same error with the new Arduino SW and the new libary...
Can anyone help me??

Thanks Mike

I have the same error with the new Arduino SW

I am almost certain that the IDE does NOT show "new Arduino SW" as the dialog title. What version do you think is new?

and the new libary

What is a libary? Which library are you talking about?

Post your code AND the COMPLETE error message(s)!

My Arduino IDE offers 2 DCF77 libraries. I'd expect that at least one of these should compile without errors.

Hey I'm new to Arduino and new here as well so pls bare with me :wink:

#2 I changed it like u said but now I have a mistake called:

Arduino: 1.8.9 (Mac OS X), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

DCF77_Test:2:21: error: TimeLib.h: No such file or directory
compilation terminated.
exit status 1
TimeLib.h: No such file or directory

Now of course I checked if there is such a Library for Download but I Couldn't find anything. Can Anyone Help?

Thx in advance :wink:

DCF77_Test:2:21: error: TimeLib.h: No such file or directory
compilation terminated.
exit status 1
TimeLib.h: No such file or directory

Now of course I checked if there is such a Library for Download but I Couldn't find anything. Can Anyone Help?

Use the Library Manager in the IDE to find Time by Michael Margolis Version 1.5.0
Install that, and in the sketch use

#include <TimeLib.h>

This confusing situation was caused by a Windows issue about case sensitive file names where Time.h and time.h were seen as the same file. Bill Perry explains it this way here

Windows treats the filenames Time.h and time.h the same, even though they are not the same file so if there is a system file called time.h , which there is for some Arduino cores, then Windows will fail to build things correctly since it can grab time.h instead of Time.h which will cause problems since it is the wrong header file.

This is not really a problem with the library and it is not a problem for other operating systems that don't ignore the case of letters in filenames. It is a Windows problem in the way Windows handles filenames.

To work around this Windows issue, a file called TimeLib.h was created in the Time library.
So if you are using Windows, you will need to include TimeLib.h and not Time.h
Simple as that.
Also, using TimeLib.h will work for all the other operating systems that don't have this case issue.