From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,5c7411e3cf60a1d7,start X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,5c7411e3cf60a1d7,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-01-05 12:58:45 PST Xref: gmd.de comp.os.vms:38124 comp.sys.dec:12699 Path: gmd.de!xlink.net!howland.reston.ans.net!agate!dog.ee.lbl.gov!hellgate.utah.edu!cc.usu.edu!sy_j.pgh.wec.com!user Newsgroups: comp.os.vms,comp.sys.dec Subject: need help using RTL time functions Message-ID: From: ah301@yfn.ysu.edu (Jerry Sy) Date: Wed, 05 Jan 1994 13:20:27 -0500 Followup-To: comp.os.vms,comp.sys.dec Nntp-Posting-Host: sy_j.pgh.wec.com I am writing a simple Vax C program to calculate time difference, but the RTL LIB$ functions does not seem to be returning to me the correct results. can anybody tell me what I am doing wrong ? My code is shown below. I know that the difference should be 30 minutes but the RTL function gives me 24 minutes as the difference between 7:30 and 7:00! please email replies if possible. thanks in advance JERRY /* INCLUDE FILES */ #include stdio #include stdlib #include time #include string #include descrip #include libdtdef unsigned long result,operation,delta_min; typedef struct dsc$descriptor_s desctype; desctype dateA,dateB; unsigned long qDateA,qDateB,qDateDiff; static char TimeA[24],TimeB[24]; void initDesc(char* theStr,desctype* theDesc,int len); main() { initDesc(TimeA,&dateA,23); initDesc(TimeB,&dateB,23); strcpy(TimeA,"28-DEC-1993 07:00:00.00"); strcpy(TimeB,"28-DEC-1993 07:30:00.00"); result=lib$convert_date_string(&dateB,&qDateB); result=lib$convert_date_string(&dateA,&qDateA); result=lib$sub_times(&qDateB,&qDateA,&qDateDiff); operation=LIB$K_DELTA_MINUTES; result=lib$cvt_from_internal_time(&operation,&delta_min,&qDateDiff); } void initDesc(char* theStr,desctype* theDesc,int len) { theDesc->dsc$w_length=len; theDesc->dsc$b_dtype=DSC$K_DTYPE_T; theDesc->dsc$b_class=DSC$K_CLASS_S; theDesc->dsc$a_pointer=theStr; }