Time Library added to Playground

Prefixing the macros does reduce the likelihood of name collision but it makes them less Arduino like.

I could change them to inline functions so the compiler will warn if the user provides a function with a similar name. Lets see if there other opinions on how best to address this.

I did not think that the macros might be useful for the library user, then I think your inline function suggestion is the way to go :slight_smile:

The name tmElements_t was chosen because this structure was really intended for programmers writing time provider code rather than use in a sketch (I wanted to keep the tm prefix to remind programmers that its derived from the C tm structure). But I can certainly change the name if it looks like TimeElements could be useful in a sketch.

Well, all ideas I can think of (beyond the helloworldlike clock use-case) would've used such a TimeElements structure.

Maybe a timelapse photo that follows a predetermined 'most traffic of the day' time. Then a day of week, and a time of day datarepresentation would be useful. Your tmElements_t would be a perfect storage container.

Or a simple alarm/eventgenerator with alarms/events triggering each year, each month, each day of week, each hour etc etc..

I can think of many more use-cases, but now. Enough from me, I'll let someone else speak their mind :slight_smile: