You request the time, then receive the response.
That’s it.
You need to separate (parse) the date and time elements out as you need it,
The next time you request the CCLK, it will have an updated time.
You NEVER have to set the time, it’s derived from the cell.
no my question is that ones i set the time of modem … if I turn off the modem and then turn on it ….can I get the correct time without setting it again
AT+CCLK read the "RTC" of your simcom module. If not set, you get the firmware time from bootup.
You need tell the simcom module, to fetch the gsm celltower time. This service is not enabled in some countrys and the clock is not always to be trusted. Its a matter of money.. You can ask the simcom module to fetch gsm celltower time with AT+QNITZ. You can also set the timezone with AT+CTZU. The gsm celltower broadcast (if any) within tens of minuttes. So, my opinion, useless function. I use simcom modules with GPS feature and parse the date and time. So, I get GPS time. After 13-14 minuttes, I get UTC time, with leap second compensation. You can use this time to set the Simcom "RTC" or a external RTC, like DS3231 and f.ex set the clock every 24 hours. You can also poll a NTP server over the internet. But then you need a very good code to verify the time and date, as the network may be down, busy or yield false data, that damage your program for execution.
If you have simcom module with gps function, power on the gps module: AT+CGPSPWR=1. Then, you can ask for a simcom made, sumarization string, of relevant data: AT+CGPSINF. You can also ask the simcom module for one nmea readout, our continous nmea readouts.
My Solution to this Problem
Instead of using NTP, you can get the time directly from the network using the following AT commands:
Enable Automatic Time Update:
plaintext
AT+CTZU=1
This command enables the module to automatically update its internal clock from the network time.
Check the Current Time:
AT+CCLK?
Formate for this is +CCLK: "yy/MM/dd,hh:mm:ss±zz"
The time zone offset (±zz) is given in quarters of an hour (1/4 hour). For example, I live in Germany, so I get this response:
+CCLK: "24/08/29,01:14:17+08"
Here, +08 means the time zone is UTC+2 hours because 8 quarters of an hour equals 2 hours (8/4 = 2).
If you still get the wrong time zone. I have no idea don't ask me lol
Btw, what the hell is this thread? Only semi-useful replies to your problem. If Tordens had taken 5 seconds to Google, he would have realized that the A7670 does not have a GPS function
Your "solution" do not work, as the GSM towers general do not provide correct time. Google "nits problem" and voila, seems like your "solution" dont work and probably a better idea is to feth gps time and get a module that realy can do it without hassle.