PaulStoffregen / Time

Time library for Arduino

Home Page:http://playground.arduino.cc/code/time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug in minutesToTime_t macros

rob040 opened this issue · comments

commented

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

commented

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

commented

This ticket appears to be a duplicate if ticket #154