PaulStoffregen / Time

Time library for Arduino
http://playground.arduino.cc/code/time
1.26k stars 670 forks source link

bug in minutesToTime_t macros #179

Open rob040 opened 1 year ago

rob040 commented 1 year ago

Please use this form only to report code defects or bugs.

Description

In timeLib.h, there are 4 usefull macros that in its current state are not useable"

/* Useful Macros for converting elapsed time to a time_t */
#define minutesToTime_t ((M)) ( (M) * SECS_PER_MIN)  
#define hoursToTime_t   ((H)) ( (H) * SECS_PER_HOUR)  
#define daysToTime_t    ((D)) ( (D) * SECS_PER_DAY) // fixed on Jul 22 2011
#define weeksToTime_t   ((W)) ( (W) * SECS_PER_WEEK)  

The Space between macro name and its argument list is not allowed, and must be removed. Also the double braces in arglist should be changed to singe.

Steps To Reproduce Problem

Use in code and try to compile. It fails.

Hardware & Software

unrelated.

Arduino Sketch

// Change the code below by your sketch (please try to give the smallest code which demonstrates the problem)
#include <Arduino.h>
#include "TimeLib.h"

void setup() {
 time_t tt = minutesToTime_t(60);
}

void loop() {
}

Errors or Incorrect Output

rob040 commented 1 year ago

Since there is no maintenance on this library, everyone has to fix this on its own or do not use the listed macros.

rob040 commented 1 year ago

This ticket appears to be a duplicate if ticket #154