Probably not the prettiest way to do this, but here's a thought:
    
    
    import times, strutils
    
    let
      startEpochTime = epochTime()
      startEpochSec = ($startEpochTime).split(".")[^1]
      startTimeInfo = getLocalTime(fromSeconds(startEpochTime))
      startTimeStr = startTimeInfo.format("yyyy-MM-dd HH:mm:ss")
      startTimeWithSec = startTimeStr & "." & startEpochSec[0..2]
    
    echo "Time float:  " & startEpochTime.formatFloat(precision = 32)
    echo "Time string: " & startTimeWithSec
    
    

I get something like:

> Time float: 1506306890.9849119186401367187500
> 
> Time string: 2017-09-24 22:34:50.984

Reply via email to