7 mod built-in module, 1 mod.seccounter(), 2 mod.sleep(sleeptime) – Rainbow Electronics GM862-GPS User Manual
Page 43

Easy Script
in Python
80000ST10020a Rev.8 - 01/10/08
Reproduction forbidden without Telit Communications S.p.A. written authorization - All Rights Reserved
page 43 of 100
2.7 MOD built-in module
MOD built-in module is the interface between Python and module miscellaneous functions. You need
to use MOD built-in module if you want to generate timers in Python script.
If you want to use MOD built-in module you need to import it first:
import MOD
then you can use MOD built-in module methods like in the following example:
MOD.sleep(15)
this blocks Python script execution for 1.5s.
More details about MOD built-in module methods are in the following paragraphs.
2.7.1 MOD.secCounter()
Returns seconds elapsed since 1 January 2000. This method is useful for timers generation in Python
script. No input parameter.
Return value is a Python long integer which is the value of seconds elapsed since 1 January 2000.
AT+CCLK command allows to read and set current date and time.
Here are some useful constants:
•
1 day = 86400 seconds
•
1 year = 31536000 or 31622400 seconds
•
30 years from 1 January 1970 to 1 January 2000 = 946684800 seconds
(simply add this constant if you need seconds elapsed since 1 January 1970)
Example:
a = MOD.secCounter()
returns seconds elapsed since 1 January 2000.
2.7.2 MOD.sleep(sleeptime)
Blocks Python script execution for a given time returning the resources to the system. Input parameter
sleeptime is a Python integer which is measured in 1/10s and used to block script execution for given
value. No return value.
Example:
MOD.sleep(15)