-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yuriy Yakovenko
committed
Feb 4, 2019
1 parent
4ad1e2f
commit 77f745d
Showing
4 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version: 2.1 | ||
jobs: | ||
build: | ||
docker: | ||
- image: fpco/stack-build:lts | ||
steps: | ||
- checkout | ||
- restore_cache: | ||
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/ | ||
name: Restore Cached Dependencies | ||
keys: | ||
- cci-demo-haskell-v1-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }} | ||
- run: | ||
name: Resolve/Update Dependencies | ||
command: stack setup | ||
- run: | ||
name: Run tests | ||
command: stack test | ||
- run: | ||
name: Install executable | ||
command: stack install | ||
- save_cache: | ||
name: Cache Dependencies | ||
key: cci-hauth-haskell-v1-{{ checksum "package.yaml" }}-{{ checksum "stack.yaml" }} | ||
paths: | ||
- ".stack" | ||
- ".stack-work" | ||
- store_artifacts: | ||
# Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ | ||
path: ~/.local/bin/hauth | ||
destination: hauth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
module Time (hexTime) where | ||
module Time (hexTime, toHex) where | ||
|
||
import qualified Data.Time.Clock.POSIX as PT | ||
import Data.Hex (hex) | ||
import qualified Numeric as N | ||
|
||
data HexTime = HexTime String deriving Show | ||
|
||
-- get unix time in HEX format | ||
hexTime :: IO HexTime | ||
hexTime = fmap (HexTime . hex . show . round . flip (/) 30) PT.getPOSIXTime | ||
hexTime = fmap (HexTime . toHex . round . flip (/) 30) PT.getPOSIXTime | ||
|
||
toHex :: Integral a => a -> String | ||
toHex s = N.showHex (toInteger s) "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters