Page 1 of 1

Posted: Sat Aug 01, 2009 3:33 am
by ArndW
You will need to declare your Timestamp column with the extended attribute of "microseconds" in order to store fraction seconds.

Posted: Sat Aug 01, 2009 5:58 am
by lindatgeorge
The column is already declared like that to accomdate fractional milliseconds

Posted: Sat Aug 01, 2009 6:49 am
by ArndW
Why not use the derivation of "CurrentTimestampMS()", that works for me.

Posted: Sat Aug 01, 2009 8:15 am
by chulett
What flavor of UNIX? From what I recall, not all support milliseconds from the system time.

Posted: Tue Aug 04, 2009 3:07 am
by Sreenivasulu
They do not support from the date function called from shell prompt.

But you use a c function in unix you can get milliseconds

e.g in linux gettimeofday can be used for this purpose

Regards
Sreeni

Posted: Tue Aug 04, 2009 5:27 pm
by ray.wurlod
You can use a server routine.

If $OPTIONS TIME.MILLISECOND is set, then SYSTEM(12) returns the current time in milliseconds since midnight, provided that the operating system supports milliseconds.

Code: Select all

FUNCTION NowMS(Format)

$COPYRIGHT "Copyright (c) 2004, Ray Wurlod.  All rights reserved.  May be freely used with this copyright notice intact."

$OPTIONS TIME.MILLISECOND

      Equate DP To "."                   ; * change for different locale

      Now = System(12)                   ; * internal format
      Time = Time()
      If Time = Now
      Then
         MS = "000"                      ; * milliseconds not supported
      End
      Else
         MS = Mod(Now,1000)              ; * milliseconds portion of time
      End

      Begin Case
         Case UnAssigned(Format) Or IsNull(Format)
            Ans = @NULL
         Case Format = 0                 ; * internal format
            Ans = Now/1000
         Case Format = 1                 ; * time format (HH:MM:SS.sss)
            Ans = Oconv(Now/1000, "MTS") : DP : MS
         Case Format = 2                 ; * timestamp format using today's date
            Ans = Oconv(Date(), "D-YMD[4,2,2]") : " " : Oconv(Now/1000, "MTS") : DP : MS
         Case @TRUE
            Ans = @NULL
            Call DSTransformError("Invalid format argument.", "NowMS")
      End Case

RETURN(Ans)