
Section 4: Applications
Series 3700A System Switch/Multimeter User's Manual
Example: IEEE-1588 in Series 3700A-based systems
This section discusses examples of a few applications that are possible using IEEE-1588.
Scheduling alarms
You can schedule alarms to request the Series 3700A to perform actions at a specific time and date
or at a specific time interval. You can schedule alarms in UTC or PTP time; however, it is important to
be consistent in defining the alarms using the same time format. Otherwise, the alarms will fire on the
networked devices at different times, with a time difference equal to the difference between PTP and
UTC.
You can set a maximum of two alarms for each Series 3700A.
To schedule an alarm, first convert the desired alarm time to UTC seconds. You can perform this
conversion using
os.time
. If you are specifying alarms in UTC time, you can use this value with
schedule.alarm[
N
].seconds
to schedule an alarm, where
N
represents the tag number of the
alarm that you configure.
NOTE
os.time
is a Lua function that can be used to return the current time or convert a local date and time
to UTC-based seconds elapsed since January 1, 1970. When used without parameters,
os.time
returns the current date and time. When used with parameters, the syntax is
os.time{year =
<n>, month = <n>, day = <n>, hour = <n>, sec = <n>, isdst = <b>}
.
<n>
is a
number and
<b>
is a Boolean where true is Daylight Savings Time. It is not necessary to specify all
parameters.
The following example demonstrates how to use
os.time.
Example program code to use os.time
Code
Notes and comments
print(os.time)
Retrieve current UTC time in seconds
since 1/1/1970.
local l_start_Time
l_start_Time = os.time{year=2008, month=3, day=1,
hour=15}
Convert 3:00PM March 1, 2008 to
UTC seconds since 1/1/1970.
local l_start_Time
l_start_Time = os.time() + 60
Create start time to occur 60 seconds
after current time.
To specify alarms in PTP format, convert UTC seconds to PTP seconds by adding the value returned
by
ptp.utcoffset
to the UTC time. The Series 3700A alone does not differentiate between PTP
and UTC time. Use the converted PTP time in setting values for
schedule.alarm[
N
].ptpseconds
, where
N
represents the number of the alarm you configure.
4-20
3700AS-900-01 Rev. A / July 2011