Time.now() not working in Timealarms library

i was trying to get timestamp using Time.now(). while time interval is running with Timealarms library, i am getting an error
lib/TimeAlarms/TimeAlarms.h:14:15: expected unqualified-id before ‘(’ token

there is nothing in 14th line.

It could be and often is up a little higher above the 14th line in your code where you will find the problem.

1 Like

If it’s bailing in the .h file, look at where it’s included in the source and look for problems above that.

This seems to either come from targeting an old system version or using a version of the library that’s targeted at one.

it was not a problem in the code. i was getting error only when i add Time.now()
i used Time.local() and it worked

Hi @shafeekashraf44

There is a macro definition problem in that ported library. In your code where you include the TimeAlarms library, right after that you need to undefined the problem:

#include "TimeAlarms.h"
#undef now()

adding #undef now() under all the header files solved the problem.
thank you

1 Like