time and date library

I'm trying to use the time and date library and i'm getting odd results - probably something i don't understand. I can use the setTime with a single argument of seconds since 1970 but when i try to use it with multiple arguments [setTime(hr,min,sec,day,month,yr)] I get anomalous results.

The following is adapted from the serial example - it should show the same time twice(I thought) but no such luck. I tried it on arduino 21 just in case but no change.

/* 
 * TimeSerial.pde
 * you can send the number on the next line to set the clock to noon Jan 1 2010
 1262347200  
 */ 
 
#include <Time.h>  

void setup()  {
  Serial.begin(115200);
  Serial.println("Testing Time Setting Functions");
  setTime(1262347200); // seconds since jan 1 1970
  digitalClockDisplay();  
  setTime(12,0,0,1,1,2010); // another way to set the time setTime(hr,min,sec,day,month,yr)
  digitalClockDisplay();    
}

void loop(){    
}

void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

the results are

Testing Time Setting Functions
12:00:00 1 1 2010
22:22:56 31 10 2020

Arduino 21 on a Duemilanove:
Testing Time Setting Functions
12:00:00 1 1 2010
12:00:00 1 1 2010

PaulS:
Arduino 21 on a Duemilanove:
Testing Time Setting Functions
12:00:00 1 1 2010
12:00:00 1 1 2010

huh! Thanks so much for trying it paul. did you download the library recently? I notice it's got fixes as of july.

running off to get my due...

did you download the library recently?

Half an hour ago...

ok, this is the oddest darned thing. using a diecimila/168 i get correct results, my RBBB with 328 gives incorrect results!

I'll move some processors around and see what's up.

Thanks again paul.

btw is your duemilanove a 168 or a 328.

A 328.

I downloaded 0022, and compiled and tested on a Mega2560. Same (good) results.

ok, took me a while to get a fresh 328 burned but the issue is the particular chip i was using. i suspect maybe a bad memory patch that only showed up with a more complex program. huh!

bill2009:
... I notice it's got fixes as of july.

Good to hear you found the problem.
FYI, the recent fix was only to correct the little used convenience macro : daysToTime_t

I want to display date and time on 16*4 lcd . i download DateTime.h library. but code was not complied. reply please

vidya_ACSPL:
I want to display date and time on 16*4 lcd . i download DateTime.h library. but code was not complied. reply please

The DateTime library in the playground is obsolete and was replaced by newer code four years ago. There is a note on the web page for the old DateTime code that provides the link to the latest version: Arduino Playground - Time.

A little time searching in this forum or with google should turn up a number of examples of LCD clocks built using the Time library.
here is one example: Siliconfish: Arduino LCD Countdown Clock