void CInArchive::ReadVolumeDescriptor(CVolumeDescriptor &d) { d.VolFlags = ReadByte(); ReadBytes(d.SystemId, sizeof(d.SystemId)); ReadBytes(d.VolumeId, sizeof(d.VolumeId)); SkipZeros(8); d.VolumeSpaceSize = ReadUInt32(); ReadBytes(d.EscapeSequence, sizeof(d.EscapeSequence)); d.VolumeSetSize = ReadUInt16(); d.VolumeSequenceNumber = ReadUInt16(); d.LogicalBlockSize = ReadUInt16(); d.PathTableSize = ReadUInt32(); d.LPathTableLocation = ReadUInt32Le(); d.LOptionalPathTableLocation = ReadUInt32Le(); d.MPathTableLocation = ReadUInt32Be(); d.MOptionalPathTableLocation = ReadUInt32Be(); ReadDirRecord(d.RootDirRecord); ReadBytes(d.VolumeSetId, sizeof(d.VolumeSetId)); ReadBytes(d.PublisherId, sizeof(d.PublisherId)); ReadBytes(d.DataPreparerId, sizeof(d.DataPreparerId)); ReadBytes(d.ApplicationId, sizeof(d.ApplicationId)); ReadBytes(d.CopyrightFileId, sizeof(d.CopyrightFileId)); ReadBytes(d.AbstractFileId, sizeof(d.AbstractFileId)); ReadBytes(d.BibFileId, sizeof(d.BibFileId)); ReadDateTime(d.CTime); ReadDateTime(d.MTime); ReadDateTime(d.ExpirationTime); ReadDateTime(d.EffectiveTime); d.FileStructureVersion = ReadByte(); // = 1 SkipZeros(1); ReadBytes(d.ApplicationUse, sizeof(d.ApplicationUse)); SkipZeros(653); }
void TclpGetTime( Tcl_Time *timePtr) /* Location to store time information. */ { UnsignedWide micro; #ifndef NO_LONG_LONG long long *microPtr; #endif if (initalized == false) { MachineLocation loc; long int offset; ReadLocation(&loc); offset = loc.u.gmtDelta & 0x00ffffff; if (offset & 0x00800000) { offset = offset | 0xff000000; } if (ReadDateTime(&baseSeconds) != noErr) { /* * This should never happen! */ return; } /* * Remove the local offset that ReadDateTime() adds. */ baseSeconds -= offset; Microseconds(µOffset); initalized = true; } Microseconds(µ); #ifndef NO_LONG_LONG microPtr = (long long *) µ *microPtr -= *((long long *) µOffset); timePtr->sec = baseSeconds + (*microPtr / 1000000); timePtr->usec = *microPtr % 1000000; #else SubtractUnsignedWide(µ, µOffset, µ); /* * This lovely computation is equal to: base + (micro / 1000000) * For the .hi part the ratio of 0x100000000 / 1000000 has been * reduced to avoid overflow. This computation certainly has * problems as the .hi part gets large. However, your application * would have to run for a long time to make that happen. */ timePtr->sec = baseSeconds + (micro.lo / 1000000) + (long) (micro.hi * ((double) 33554432.0 / 15625.0)); timePtr->usec = micro.lo % 1000000; #endif }
unsigned long TclpGetSeconds() { unsigned long seconds; MachineLocation loc; long int offset; ReadLocation(&loc); offset = loc.u.gmtDelta & 0x00ffffff; if (offset & 0x00800000) { offset = offset | 0xff000000; } if (ReadDateTime(&seconds) == noErr) { return (seconds - offset); } else { panic("Can't get time."); return 0; } }