Skip to content

Instantly share code, notes, and snippets.

@PsyDebug
Created December 8, 2017 15:30
Show Gist options
  • Save PsyDebug/fc682bebf0b308781ff083b057973222 to your computer and use it in GitHub Desktop.
Save PsyDebug/fc682bebf0b308781ff083b057973222 to your computer and use it in GitHub Desktop.
Get suid as date
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty (scotty, get, ScottyM, ActionM, text)
import Data.Time
import Control.Monad.IO.Class
import Data.Text.Lazy
routes :: ScottyM ()
routes = do
get "/suid" suid
suid :: ActionM()
suid = do
ty <- liftIO timer
text $ pack ty
timer :: IO String
timer = do
zt <- getZonedTime
return $ formatTime defaultTimeLocale "%Y%m%d%H%M%S" zt
main :: IO ()
main = scotty 7200 routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment