Seconds since January 1st 1970


I can’t make sense of this 32 bit value. I’ve set my modem date/time using +CCLK and read the timestamp (seconds since jan 1st 1970, ignoring fractions). I get 981968114, but Unix time (same thing?) is 1328036190. Not even close. Where am I going wrong ?



Can you paste part of your code , showing how you are trying to achieve
the time difference.



Just checked the time on a freshly flashed FXT009. The results are:

2012/02/02;11:22:58:387;004;26;1;Time: 2000-01-01 18:23:18 ... Sec: (946750998)/(946750998)

and the code to generate this is:

adl_rtcTime_t now;
	adl_rtcTimeStamp_t nowTs;
	s32 ret;
	ascii msg[256];

	ret = adl_rtcGetTime( &now );
	ret = adl_rtcConvertTime( &now, &nowTs, ADL_RTC_CONVERT_TO_TIMESTAMP );

	wm_sprintf(msg, "Time: %04u-%02u-%02u %02u:%02u:%02u ... Sec: (%u)/(%d)",
				now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second,
				nowTs.TimeStamp, nowTs.TimeStamp
	TRACE (( 1, msg ));

If I set the time to 2012-02-02 12:00:00 using +CCLK and reboot the modem using at+cfun=1, I then get:

2012/02/02;11:28:10:426;001;ADL;1;Time: 2012-02-02 12:00:08 ... Sec: (1328184008)/(1328184008)

Note that the AT commands guide for +CCLK indicates that the RTC will default to the last set value if there is no backup power source for the RTC… Also, it’s my experience that doing a firmware upgrade will also reset the RTC to epoch (1/1/2000).

Maybe the battery in your module has gone flat and the time is being reset across power cycles?

Try my code above and see how you get on.

ciao, Dave


Thanks I’ll try that on an Xtend. I had been setting the time but hadn’t appreciated that a reset was necessary. I d been using a Q2686 development board for my tests, which doesn’t have a battery at all.


Hi Johnny,

Oops. A reset is NOT necessary - it was only my way of showing that the time stayed up across a reset. Sorry for the confusion.

Ahhh - there’s the problem. The RTC will stay up as long as there’s power on the Q2686 dev board - across resets as well. Take the power off and the RTC will reset to Epoch.

I haven’t got my Q2868 dev board handy, and can’t remember if there is a jumper to provide external RTC power or not. There is a reasonable section in one of the Q2686 technical specs on how to set up the RTC external power supply.

ciao, Dave


Just to finish this story - I subsequently discovered that I had mis-understood the date format. I was setting the clock using CCLK, and at a glance it looked right, but it turned out that I had day/month/year fields mixed up. And I was doing this work at a time and date when this mistake wasn’t immediately obvious. Apologies if I’ve wasted anyones time.