Created
September 4, 2015 14:54
-
-
Save Taneb/8bbd177f95ebea9b590c to your computer and use it in GitHub Desktop.
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
import Graphics.Element exposing (Element) | |
import Graphics.Collage exposing (collage, toForm, text) | |
import Signal exposing ((<~)) | |
import Time exposing (Time, every) | |
import Date exposing (fromTime, hour, minute, second) | |
import String exposing (padLeft) | |
import Text exposing (Text, fromString, monospace, height) | |
import List exposing (map) | |
main = showTime <~ every Time.second | |
dateToString : Time -> String | |
dateToString t = | |
String.join ":" <| map (\f -> padLeft 2 '0' << toString << f <| fromTime t) [hour, minute, second] | |
styleDate : String -> Text | |
styleDate = fromString >> monospace >> height 100 | |
showTime : Time -> Element | |
showTime t = collage 700 700 [t |> dateToString >> styleDate >> text] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment