Permalink
Browse files

Add documentation

  • Loading branch information...
1 parent 05eb921 commit 3b9cd187657b2068411d3f2db121fe9ff9852a69 @ozataman ozataman committed Mar 18, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/Database/Cassandra/Pack.hs
@@ -61,7 +61,12 @@ newtype TTimeStamp = TTimeStamp { getTimeStamp :: TLong }
deriving (Eq,Show,Read,Ord,Enum,Num,Real,Integral,CasType)
--- | Convert commonly used 'UTCTime' to 'TTimeStamp'
+-- | Convert commonly used 'UTCTime' to 'TTimeStamp'.
+--
+-- First converts to seconds since epoch (POSIX seconds), then
+-- multiplies by a million and floors the resulting value. The value,
+-- therefore, is in micro-seconds and is accurate to within a
+-- microsecond.
toTimeStamp :: UTCTime -> TTimeStamp
toTimeStamp utc = fromIntegral . floor . (* 1e6) $ utcTimeToPOSIXSeconds utc

0 comments on commit 3b9cd18

Please sign in to comment.