Verified in Web Tools but not Local IDE

I have a very simple bit of code that works when I am using the online IDE, but when I use the local Arduino IDE, it will not verify.

What could be the difference between the online tools and the local IDE?

The error is:
Time_Test:13:5: error: 'setTime' was not declared in this scope

The code is:

#include "Time.h"

void setup() {
Serial.begin(9600);
Serial.println("Hello");

setTime(1590539298);

}

void loop() {
time_t t = now();
Serial.println(t);
delay(1000);
}

Are you using Windows?

Yes - Windows 10.

For Online Tools I'm using Edge Chrome for the browser.

The difference is that Arduino Web Editor uses Linux, which is filename case sensitive, while Windows is filename case insensitive. The toolchain has a file named time.h, whereas the library you're trying to use has a file named Time.h. On Linux, this is no problem, because that operating system considers the two filenames to be different. On windows, there is no difference between Time.h and time.h, so the compiler ends up using the time.h from the toolchain instead of the Time library, thus the error.

This is a well known problem. To deal with it, a unique filename was added to the Time library: TimeLib.h. So all you need to do is change this line of your sketch:

#include "Time.h"

to this:

#include "TimeLib.h"

and the problem will be solved.

People who are using a filename case sensitive operating system should still use TimeLib.h in their sketches in order to avoid causing this type of confusion for Windows users you might share your code with.

Yep - that did it. Thanks for the reply. Interestingly, I did see TimeLib.h in the library manager and thought it looked to be the same library (same author, etc...). I almost included it, but I was convinced it would actually be importing a different library, and if it worked, I wouldn't understand why.

Now it all makes sense. Thanks for clarifying.

-Matt

You're welcome. I'm glad to hear it's working now. Enjoy!
Per