Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Time compatibility issue between Java and C

Reply
Thread Tools

Time compatibility issue between Java and C

 
 
Adi
Guest
Posts: n/a
 
      06-30-2006
Hello friend,
Recently I encountered a problem which involve time
synchronication/scheduling between two remote systems. One system
running a Java program has to schedule a task on another system running
a C prog. on TCP interface.
Problem is how to send time/date independent of time-zone and
programming issues. Since systems might have different OS, so epoch
time might cause problem ( I heard UNIX take base value as 1 Jan, 1970
while Win2K takes 1 Jan, 1900).
I just want the value and date-type conformity so as to make message
parsing as simple as possible. So what should be the date-time format
and the data type to use???
Please help in this regard ASAP,
Adi

 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      06-30-2006
In article <(E-Mail Removed) .com>,
Adi <(E-Mail Removed)> wrote:
> Recently I encountered a problem which involve time
>synchronication/scheduling between two remote systems. One system
>running a Java program has to schedule a task on another system running
>a C prog. on TCP interface.
>Problem is how to send time/date independent of time-zone and
>programming issues.


Before that, you have to figure out how to synchronize the times
on the two systems, and -keep- them synchronized.

>Since systems might have different OS, so epoch
>time might cause problem ( I heard UNIX take base value as 1 Jan, 1970
>while Win2K takes 1 Jan, 1900).


I would suggest that you examine how ntp (Network Time Protocol)
handles the issue.
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
 
Reply With Quote
 
 
 
 
Nelu
Guest
Posts: n/a
 
      06-30-2006
"Adi" <(E-Mail Removed)> writes:

> Hello friend,
> Recently I encountered a problem which involve time
> synchronication/scheduling between two remote systems. One system
> running a Java program has to schedule a task on another system running
> a C prog. on TCP interface.
> Problem is how to send time/date independent of time-zone and
> programming issues. Since systems might have different OS, so epoch
> time might cause problem ( I heard UNIX take base value as 1 Jan, 1970
> while Win2K takes 1 Jan, 1900).
> I just want the value and date-type conformity so as to make message
> parsing as simple as possible. So what should be the date-time format
> and the data type to use???
> Please help in this regard ASAP,


You could create the time using mktime then get the time_t value
returned and pass it to gmtime. The struct tm structure you get has
the UTC time in its components. You can do somehting similar in JAVA
using a GregorianCalendar and an instance of TimeZone to convert to
UTC. Now, the components of the GregorianCalendar and struct tm both
show the time for the same time zone, UTC. You can use those values
for synchronization and you can use another TimeZone instance to
switch back to local time or the localtime function in C. You can
avoid using the time_t values this way.


--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
problems of compatibility between xD picture card (512 mb) and Olympus C60 antonioparodi74@gmail.com Digital Photography 1 01-31-2006 05:18 AM
(Un)compatibility between files generated from C++ and Java Maria Java 1 12-17-2004 11:40 PM
Problem with frozen app: compatibility between Unixware and SCO Unix Mike Kent Python 2 12-30-2003 06:10 PM
gdbm compatibility between linux and freebsd bucket79 Python 1 08-21-2003 10:27 AM



Advertisments