38 #include "../netsync.h"
46 int main (
int argc,
char* argv[]) {
50 long starttime, endtime;
62 n = gettimeofday (&tv, &tz);
64 i=gethostname (name,80);
65 if (i!=0) printf (
"Failed to get host name.\n");
68 printf(
"not enough hosts\n");
72 hostlist = (
char**)malloc(
sizeof(
char *) * argc -2);
73 for (i=1; i<argc; i++)
74 hostlist[i-1] = argv[i];
77 netsync_init(argc-1 , hostlist);
80 n = gettimeofday (&tv, &tz);
81 starttime=(tv.tv_sec%1000)*1000 + (tv.tv_usec/1000);
87 char magic[]=
"Hallo Welt";
88 if (netsync_amiroot() ) {
89 sprintf(buffer,magic);
92 bufflen = strlen(magic)+1;
94 res=netsync_sync(netsync_finished, buffer, &bufflen);
95 printf(
"Sync returned: %s\n",buffer);
97 printf (
"Netsync aborted \n");
100 n = gettimeofday (&tv, &tz);
101 endtime=(tv.tv_sec%1000)*1000 + (tv.tv_usec/1000);
102 fprintf (stdout,
"%03d %14s duration: %4i ms %i ms\n",
103 i,name,endtime-starttime,endtime);