Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VxWorks and time of day

479 views
Skip to first unread message

Daniel Karpinski

unread,
Jun 10, 1997, 3:00:00 AM6/10/97
to

Hello,

Our system includes several Sun processors (running Unix) and
several Motorola processors (running VxWorks). We would like
to use the Unix "gettimeofday" library function to coordinate
timing between the processors, but we've been unable to find a
comparable time function for VxWorks. Can anyone suggest a
VxWorks function I may have overlooked?

Thanks,
Dan Karpinski

Dennis Chou

unread,
Jun 11, 1997, 3:00:00 AM6/11/97
to

Try clock_gettime() in clockLib

--
-------------------------------------------------------
Dennis Chou
Realtime Software Consultant

Innovative Software Design
dch...@hotmail.com

-------------------------------------------------------

Mike Anderson

unread,
Jun 19, 1997, 3:00:00 AM6/19/97
to

--MimeMultipartBoundary
Content-Type: text/plain; charset="us-ascii"

At 04:00 AM 6/19/97 PDT, you wrote:
>From: Daniel Karpinski <karp...@syr.lmco.com>


>
>Hello,
>
>Our system includes several Sun processors (running Unix) and
>several Motorola processors (running VxWorks). We would like
>to use the Unix "gettimeofday" library function to coordinate
>timing between the processors, but we've been unable to find a
>comparable time function for VxWorks. Can anyone suggest a
>VxWorks function I may have overlooked?
>

No, there's nothing you've overlooked. However, there are are many
mechanisms to accomplish this depending on how close you want the
two (or more) processors to be. In fact, I teach many of these
techniques in SPARTA's Real-time training courses specifically targeted
at VxWorks.

Time base coordination can be a rather tricky problem depending on the
resolution required. Several of us actually use time code boards like
those from Datum/Bancomm. The resolution ranges from 1 ms (IRIG-B) to
1 us (IRIG-G & IRIG-A). The advantage of the IRIG-B is that it's rained
down from GPS and can be used to coordinate the time base across very
large test ranges (IRIG stands for Inter-Range Instrumentation Group).
You can even get your very own Cesium clock on a VME form factor if you need
that resolution. But it costs big $$$.

Another possibility is to use the Network Time Protocol (NTP). With NTP,
several servers average their time across the LAN/WAN and establish
a "standard" time. There is an NTP version 1 implementation at the
user's group archives. Many folks have ported the Version 3 to VxWorks,
but I haven't seen it appear on the archives as of yet. Perhaps some
kind soul would like to post it to the net? In any case, NTP will
give you a resolution somewhere in the few ms range owing to clock
drift inherent in typical Unix boxes.

If you just need to get into the ballpark, then you can try somthing we do
in my training labs. Namely, get the date/time using rcmd or connect to
the date/time network ports and then encode the time into clock ticks
(storing the date as globals). Then write your gettimeofday interface
to decode the clock ticks and globals. Alternatively, if you have a
wall clock time chip (i.e., DS-1216 or M48T08) on board, get the time/date
from the Unix host as before but then your gettimeofday call decodes the
hardware clock chip. This will typically get you synchronization with
your Unix host to within a couple of seconds.

HTH,

==============================================================================
__ Real-Time System Development, Integration, Training and Services
//\\
// \\ Mike Anderson
// /\ \\ Chief Engineer Voice : (703) 448-0210 ext. 235
// / \ \\ SPARTA, Inc. FAX : (703) 893-5494
// \ \\ 7926 Jones Branch Drive EMAIL : m...@mclean.sparta.com
\\ \ // Suite 900 Web : http://www.mclean.sparta.com
\\ \ / // McLean, VA 22102
\\ \/ // "Software development is like making
\\ // a baby... You can't make a baby in one
\\// month by impregnating nine women.
-- "Pride in Performance" Some things just take time."
==============================================================================
--MimeMultipartBoundary--

Rada, Jeff A

unread,
Jun 19, 1997, 3:00:00 AM6/19/97
to

--MimeMultipartBoundary
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit


>
> Subject: VxWorks and time of day
>
>-------------------------------------------------------
>
>Newsgroups: comp.os.vxworks
>Subject: VxWorks and time of day
>Date: Tue, 10 Jun 1997 16:06:48 -0400
>From: Daniel Karpinski <karp...@syr.lmco.com>
>Organization: Lockheed Martin (Syracuse, NY)
>Message-ID: <339DB3D8...@syr.lmco.com>
>
>Hello,
>
>Our system includes several Sun processors (running UNIX) and


>several Motorola processors (running VxWorks). We would like
>to use the Unix "gettimeofday" library function to coordinate
>timing between the processors, but we've been unable to find a
>comparable time function for VxWorks. Can anyone suggest a
>VxWorks function I may have overlooked?
>


I have a suggestion.
One way is to use the network to get the time and set your vxWorks
system clocks to that.


simple code example
I just included the basics:

int fd;char
time_buffer[TIME_BUFFER_SIZE];struct sockaddr_in tcp_server_address;/*
create sockaddr struct */ tcp_server_address.sin_family = AF_INET;
tcp_server_address.sin_port = htons (TCP_DAYTIME_PORT);

/* connect to the tcp server. */ if (ERROR == connect (fd,
(struct sockaddr *) &tcp_server_address,
sizeof (tcp_server_address))) {/* read back the date/time
information furnished by the TCP server. */ if (read (fd, time_buffer,
TIME_BUFFER_SIZE) > 0) { close (fd); }

This should allow you to get the time.

Jeffrey A. Rada Phone: 910-395-7690
Orion Systems Engineering Fax: 910-395-7255
Telecommunications Products Div. Lynx: 283-7690
Corning Incorporated Email: Rad...@Corning.com

http://www.corningfiber.com
--MimeMultipartBoundary--

Donald McLachlan

unread,
Jun 20, 1997, 3:00:00 AM6/20/97
to

There is a usrTime library out there which we have used on the Heurikon HKV4F,
the Motorola MV167, and on the Performance Technologies PT151 card. It provides
get/settimeofday, adjtime, ctime, julday etc.

We have also written a somewhat simplified ntp-like client server package
which can be used to sync the vmWorks client to another machine. In our case the
other machine is a Sun Unix box (running the server) which in turn runs NTP and
is synchronised to a GPS time.


--
Donald McLachlan e-mail donald.m...@crc.doc.ca
Communications Research Centre / DRX office 613-998-2845
3701 Carling Ave., fax 613-998-9648
Ottawa, Ontario labs 613-998-2423 / 613-998-4118
K2H 8S2 home 613-599-6262
Canada

0 new messages