Skip to content

Commit

Permalink
shared-kernel/fix:#187/Added Redis Sorted Set Functions and Redis Str…
Browse files Browse the repository at this point in the history
…eams Functions for Job Scheduling...
  • Loading branch information
suraj.kumar1 authored and DwivediAman-exe committed Aug 4, 2023
1 parent 89ec1b4 commit ed29e44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/mobility-core/src/Kernel/Utils/Time.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ where
import qualified Data.Text as T
import Data.Time hiding (getCurrentTime, nominalDiffTimeToSeconds, secondsToNominalDiffTime)
import qualified Data.Time as Time hiding (secondsToNominalDiffTime)
import Data.Time.Clock.System (SystemTime (systemNanoseconds, systemSeconds), utcToSystemTime)
import EulerHS.Prelude
import Kernel.Types.Time
import Kernel.Utils.Logging
Expand All @@ -48,6 +49,12 @@ showTimeIst time =
formatTime defaultTimeLocale "%d %b, %I:%M %p" $
addUTCTime (60 * 330) time

getCurrentTimestamp :: (Monad m, MonadTime m) => m Double
getCurrentTimestamp = do
now <- getCurrentTime
let systemTime = utcToSystemTime now
pure . fromIntegral $ div (systemSeconds systemTime * 1000000000 + fromIntegral (systemNanoseconds systemTime)) 1000000

getClockTimeInMs :: MonadClock m => m Milliseconds
getClockTimeInMs = Milliseconds . fromInteger . (`div` 1000000) . toNanoSecs <$> getClockTime

Expand Down

0 comments on commit ed29e44

Please sign in to comment.