views:

1059

answers:

3

Guys, Does anyone know 1) how precise the vb6 Date date type is (by way of fractions of a second) and how to format it to show fractions of a second.

I'm revisiting vb6 after many years absence, and for the life of me can't remember. The things I used to know . . .

Thanks

P.S. I considered putting a "memory-leak" tag on this, because my memory leaked (hur hur hur)

P.P.S I Found this API call after wards, and it seems to work

Declare Sub GetSystemTime Lib "kernel32.dll" (lpSystemTime As SystemTime)

Public Type SystemTime
  Year As Integer
  Month As Integer
  DayOfWeek As Integer
  Day As Integer
  Hour As Integer
  Minute As Integer
  Second As Integer
  Milliseconds As Integer
End Type
A: 

I think that the Date Datatype in VB6 can not handle fractions of a second.

dummy
+1  A: 

1) Seconds only, and

2) There's no way.

GSerg
+2  A: 

The Date data type is based on the Double data type with range checking (min/max Date values) so the precision is for double prescision floating point where one day = 1, effectively nine decimal places. If you think of time in a continuum (and IMO you should) then Double is a good fit. The problem you face is that temporal functions within VBA have a minimum granularity of one second, so you will experience rounding for subsecond values; same goes for user controls etc written for VB6 e.g. I recall having to implement wrapper classes for StdDataFormat in order to read/write subsecond SQL Server values without rounding in MS Data Grid in VBA. It begins to feel like one is rolling one's own temporal data type (ouch!)

onedaywhen