Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!gatech!ncsuvx!news From: rcb@ccpv1.cc.ncsu.edu (Randy Buckland) Newsgroups: comp.sources.wanted Subject: Re: What does this assembler code do? Keywords: VAX, VMS, backup Message-ID: Date: 5 Dec 90 13:57:17 GMT References: Sender: news@ncsuvx.ncsu.edu (USENET News System) Distribution: comp Organization: NCSU Computing Center Lines: 21 ralph@laas.fr (Ralph P. Sobek) writes: >vdatetosec() >{ > asm("movl 4(ap),r0"); > asm("movl (r0)+,r2; movl (r0),r3; subl2 $2913970176,r2; sbwc $8164719,r3 "); > asm("ediv $10000000,r2,r0,r1"); >} VMS uses 64-bit integers to store the time value. It is the number of 100 nanosecond intervals since nov 17, 1858 00:00:00.00 This code expects a the address of the 64bit time parameter as the only parameter to the function. It load it into 2 registers, subtracts a constant (probably the diff between 1858 and jan 1, 1970) and divides to get seconds. In other words, it converts a vms time to a unix time. -- Randy Buckland "It's hard to work North Carolina State University in a group when you're randy@ncsu.edu (919) 737-2517 omnipotent" -- Q