# How to set RTC?

**URL:** <https://forum.sierrawireless.com/t/how-to-set-rtc/1904>\
**Category:** Open AT\
**Created:** [February 11, 2008, 12:40pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904 "2008-02-11T12:40:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![iliancostov](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@iliancostov](https://forum.sierrawireless.com/u/iliancostov)\
**Post date:** [February 11, 2008, 12:40pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/1 "2008-02-11T12:40:59Z")

</div>

Hi,  
How we can set RTC within ADL ?  
I see there is function adl\_rtcGetTime but there is no way to set it, any ideas ?  
Tnx.

---

<div class="post-metadata">

**Author:** ![wismo\_coder](https://avatars.discourse-cdn.com/v4/letter/w/6bbea6/32.png) [@wismo\_coder](https://forum.sierrawireless.com/u/wismo_coder)\
**Post date:** [February 11, 2008, 1:16pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/2 "2008-02-11T13:16:23Z")

</div>

For that purpose you need to use AT+CCLK. Unfortunately there is no adl\_rtcSetTime command. The problem with AT+CCLK is that you cannot set milliseconds. Internally the millisecond counter is not set to zero when using AT+CCLK, meaning that you need to introduce a time offset variable if you plan on using it in time critical applications. But time precision is a general problem with wismo modules. Even in ‘boost mode’ simple commands consume a few milliseconds. Theoretically the time can be measured up to microseconds, but on an ARMv9 processor the output is rather random. I guess you can use it as an alternative to the random number generator. However, an adl\_rtcSetTime command would still be interseting in the future. When will wavecom consider introducing it?

Regards,

wismo\_coder

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [February 11, 2008, 1:22pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/3 "2008-02-11T13:22:34Z")

</div>

AT Command?

Another one for the list of missing ADL support:  
[viewtopic.php?f=3&t=904&p=4451&hilit=messing+about+with+AT+commands#p4451](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=3&t=904&p=4451&hilit=messing+about+with+AT+commands#p4451)  
[viewtopic.php?t=1171&hilit=mess+about+with+AT+commands](http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?t=1171&hilit=mess+about+with+AT+commands)

---

<div class="post-metadata">

**Author:** ![iliancostov](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@iliancostov](https://forum.sierrawireless.com/u/iliancostov)\
**Post date:** [February 13, 2008, 4:04pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/4 "2008-02-13T16:04:22Z")

</div>

You have acknowledged my doubts about setting RTC …  
As it seems I’ll use AT+CCLK 😃

Thank you for reply !

---

<div class="post-metadata">

**Author:** ![davidc](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@davidc](https://forum.sierrawireless.com/u/davidc)\
**Post date:** [August 25, 2008, 5:13am UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/5 "2008-08-25T05:13:10Z")

</div>

Hi All,

Just to let you know that there is now an adl\_rtcSetTime() function in Oasis 2.02 (firmware R71a).

I’ve tested it on my Q2686 and it works OK - but you really need to ensure that the year is 4 digits long.

adl\_rtcSetTime() will accept a time structure with a two digit date value, and appear to set the time (i.e. return with no error). However, the system time (as checked with AT+CCLK?) will be wrong, and the internal RTC hardware doesn’t appear to get updated (i.e. for me the RTC reverted to the last valid time after a reboot).

Using adl\_rtcSetTime() _should_ let you set the RTC fractional seconds - but I haven’t tested it.

cheers, Dave

---

<div class="post-metadata">

**Author:** ![szym-tom](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@szym-tom](https://forum.sierrawireless.com/u/szym-tom)\
**Post date:** [June 15, 2009, 6:37pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/6 "2009-06-15T18:37:36Z")

</div>

Hello,

I have module Q2687. I have problem with function adl\_atCmdCreate, I need set RTC. This is my program:

#include “adl\_global.h”  
#include “adl\_rtc.h”

const u16 wm\_apmCustomStackSize = 1024;  
static ascii buf[256];

void HelloWorld\_TimerHandler ( u8 ID )  
{  
TRACE (( 1, “Embedded : Hello World” ));  
adl\_atSendResponse ( ADL\_AT\_UNS, “\r\nHello World from Open-AT\r\n” );  
wm\_sprintf(buf,"AT+CCLK=“08/08/08,08:08:00"”); //zapisywanie daty pod zmienna buf  
adl\_atCmdCreate(buf, ADL\_AT\_PORT\_TYPE(ADL\_PORT\_OPEN\_AT\_VIRTUAL\_BASE, FALSE), NULL, “\*”, NULL);  
}

void adl\_main ( adl\_InitType\_e InitType )  
{  
TRACE (( 1, “Embedded : Appli Init” ));  
adl\_tmrSubscribe ( TRUE, 10, ADL\_TMR\_TYPE\_100MS, HelloWorld\_TimerHandler );  
}

When program go to adl\_atCmdCreate function, program call ERROR and every thing is break. But in Terminal Emulator by at+cclk? comend a can check thay RTC was changed. Whay my program call ERROR?

Regards.

---

<div class="post-metadata">

**Author:** ![awneil](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@awneil](https://forum.sierrawireless.com/u/awneil)\
**Post date:** [June 15, 2009, 7:54pm UTC](https://forum.sierrawireless.com/t/how-to-set-rtc/1904/7 "2009-06-15T19:54:45Z")

</div>

Why don’t you just use the adl\_rtcSetTime() call - noted by davidc nearly a year ago?
