Go Down

Topic: Time and TimeAlarms Libraries – Ask here for help or suggestions (Read 82631 times) previous topic - next topic

#105
Jun 02, 2012, 01:08 pm Last Edit: Jun 02, 2012, 05:09 pm by sumustinis Reason: 1
Hi there,
Does anyone has a problem like I`m having with Time library? As soon as I do #include <Time.h> and try to verify in any sketch the Arduino IDE throws out compilation error below

/usr/share/arduino/libraries/Time/DateStrings.cpp:18:18: error: variable 'monthStr1' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

jan_bl

I got the same errors here with arduino 18, 22 and 1.01. and different Time lib versions.

/usr/share/arduino/libraries/Time/DateStrings.cpp:18:18: error: variable 'monthStr1' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

The fix for my debian system was:

go back to gcc-avr version 4.3.5-1 * and
go back to avr-libc version 1.6.8-2 *

Now everything compiles just fine

* i updated to gcc-avr 4.7.0-2 and avr-libc 1.8.0-2 which broke compiling TIME libs.

Having fun again
Jan

Roger at CCCC

Hello, I'm trying to find out why the Examples in the Time library won't compile. 

I recently downloaded Ardiuno 1.0.1, then followed the directions on the Arduino playground - Time libary page at:  http://arduino.cc/playground/Code/Time

First, I downloaded the time.zip file, then extracted the folders within it.  This yielded one folder named "Time" as well as three folders within this top level "Time" folder.  These three folders were named "DS1307RTC", "Time", and "TimeAlarms" . 

Then I copied the "Time" library into the Arduino "libraries" folder, then started Arduino.exe, and selected TimeSerial.pde from the Examples list.  This sketch loaded and I pressed "Verify" and received the error message : "The 'BYTE' keyword is no longer supported.  "  All of the example sketches failed to compile but had different error messages. 

I think I did everything correct, and did it both for the top level "Time" folder and also for the "Time" folder contained within the top level folder.  Neither one worked. 

Unless I'm doing something wrong, there must be something wrong with the folder structure of the library, but, if so, I am surprised this error is not already well known. 

I'm not very experienced with Arduino, so that's why it is confusing. 

Thanks in advance for any information about this problem.   

lion032

Hello everybody!

In my project I needed to set the ds1307rtc from individual input something that the ds1307 included with time lack.

So I want to shear the updated file that include now the function:

 
Code: [Select]
void set(int hour, int min, int sec, int day, int month, int year);

year input can be either in 4 or 2 digit format.

You can download it from my project's sourceforge page:

http://sourceforge.net/projects/computerizedtel/files/DS1307RTCNEW.rar/download

Enjoy

PaulS

Quote
Then I copied the "Time" library into the Arduino "libraries" folder, then started Arduino.exe, and selected TimeSerial.pde from the Examples list.  This sketch loaded and I pressed "Verify" and received the error message : "The 'BYTE' keyword is no longer supported.  "  All of the example sketches failed to compile but had different error messages. 

There are two libraries folders - one in your sketch folder and one in the folder where you installed the Arduino IDE. Which one did you copy the Time library to? The one in the Arduino IDE folder is NOT the proper place for user-downloaded libraries.

The BYTE message indicates that the library that contains it has not been updated for 1.0+.

How to update it has been covered many times, many ways, many places.

Roger at CCCC

Pauls:  Please indicate at least one or two of the places where update instructions are given.  I'm new to this and so don't know where to look.  Thanks !! 


PaulS

Quote
I'm new to this and so don't know where to look.

There is a search field on every single page. You could type your exact error message into that field and see what comes up.

Quarencia

Is anyone maintaining the time and timealarms libraries?  If so, can a version updated to support 1.0.1 be made available?  I've searched and can't find it, so if this is already done, please direct me to the latest location.  I have modified the version accessible from on the playground page to work wtih 1.0.1 for my own use, but it would cause a lot less confusion if there were an updated version available.  If this were done, PAULS wouldn't have to tell quite so many people how to use the search function... :)

Jack Christensen

#114
Aug 13, 2012, 12:57 pm Last Edit: Aug 13, 2012, 12:59 pm by Jack Christensen Reason: 1

Is anyone maintaining the time and timealarms libraries?  If so, can a version updated to support 1.0.1 be made available?


Good question, I would hope so.

Quote

I've searched and can't find it, so if this is already done, please direct me to the latest location.  I have modified the version accessible from on the playground page to work wtih 1.0.1 for my own use, but it would cause a lot less confusion if there were an updated version available.


What mods did you make? The only change to the libraries that I found was necessary was that TimeAlarms.cpp needed the following. Strange because the Time and DS1307RTC libraries were updated for 1.0. Several of the examples have other version-related issues, though.

Code: [Select]
#if ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif


Quote

If this were done, PAULS wouldn't have to tell quite so many people how to use the search function... :)


Indeed ;)
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

StuC

A couple of folks earlier in the thread were wondering why the TimeGPS example didn't seem to be doing anything - I was too, until I spent a little while looking at it this evening. I've written it up over on my blog, but the basic problem is that the sketch invokes the sync provider function before any data has actually been received from the GPS, so there's never going to a suitable date/time at that point. However, because TinyGPS returns a value and the sketch doesn't validate it, it thinks that zero is a valid date value and that gets mapped to 31/12/1999. Job jobbed, date set, nothing more to do here then. Except that this means you don't see anything in the Serial Monitor window except "Waiting for GPS time ...".

I've added in some validation checks to the sketch and updated it to reference the SoftwareSerial libbrary instead of NewSoftSerial and it now works as expected. If anyone is maintaining the Time library and its examples, feel free to roll the code into the download version.



Cheers, Stu

charlya

I've been having problems using Time library with watchdog timer. What I see is that at seemingly random times the Arduino gets reset.

I now believe its down to the following code in Time.cpp:

time_t now(){
  while( millis() - prevMillis >= 1000){     
    sysTime++;
    prevMillis += 1000;   
#ifdef TIME_DRIFT_INFO
    sysUnsyncedTime++; // this can be compared to the synced time to measure long term drift     
#endif   
  }
  ...


in that if the clock drift is negative, the while loop can be quite expensive.
I've replaced it with:

time_t now(){
  unsigned long nowMillis = millis();
  unsigned long diffMillis = 0;
  if (nowMillis > prevMillis) diffMillis = nowMillis - prevMillis;
  else diffMillis = prevMillis - nowMillis;
  unsigned long diffSecs = diffMillis / 1000;
  if (0 != diffSecs)
  {
   if (nowMillis > prevMillis) {
     sysTime += diffSecs;
     prevMillis += diffMillis;
#ifdef TIME_DRIFT_INFO
     sysUnsyncedTime += diffSecs // this can be compared to the synced time to measure long term drift     
#endif   
   } else {
     sysTime -= diffSecs;
     prevMillis -= diffMillis;
#ifdef TIME_DRIFT_INFO
     sysUnsyncedTime -= diffSecs; // this can be compared to the synced time to measure long term drift     
#endif
   }
  }
  ...


is this library maintained? Do you agree with this is an issue and with the fix?
regards
Charly

Mackhack

Did you ever get to resolve the issue? I'm having the same issue and have no clue how to fix it  :~
Mackhack

pYro_65

Looks like 'charlya' had a go at fixing it. open up the library file ( Time.cpp ) and find the function 'now()', comment out the first 7 lines ( first code snippet ) and copy in the longer second code.

mrty


Hello, I'm trying to find out why the Examples in the Time library won't compile. 

I recently downloaded Ardiuno 1.0.1, then followed the directions on the Arduino playground - Time libary page at:  http://arduino.cc/playground/Code/Time

First, I downloaded the time.zip file, then extracted the folders within it.  This yielded one folder named "Time" as well as three folders within this top level "Time" folder.  These three folders were named "DS1307RTC", "Time", and "TimeAlarms" . 

Then I copied the "Time" library into the Arduino "libraries" folder, then started Arduino.exe, and selected TimeSerial.pde from the Examples list.  This sketch loaded and I pressed "Verify" and received the error message : "The 'BYTE' keyword is no longer supported.  "  All of the example sketches failed to compile but had different error messages. 

I think I did everything correct, and did it both for the top level "Time" folder and also for the "Time" folder contained within the top level folder.  Neither one worked. 

Unless I'm doing something wrong, there must be something wrong with the folder structure of the library, but, if so, I am surprised this error is not already well known. 

I'm not very experienced with Arduino, so that's why it is confusing. 

Thanks in advance for any information about this problem.   



I don't know if this is the right way to do it, but I switched 'BYTE' with 'byte(0)' and now it works for me.

-Ty

Go Up