timestamps are properly padded
This commit is contained in:
parent
a8e49e9070
commit
3e84c3a5ef
@ -162,7 +162,7 @@
|
||||
(send dc draw-text input 0 height) ;; just print message to string
|
||||
|
||||
(set! listy (appendlist listy (list username input color height)))
|
||||
(set! height (+ height 15))
|
||||
(set! height (+ height 15)) ; 15 is space between messages
|
||||
; redraw overly long text on gui
|
||||
(set! min-v-size (+ min-v-size 15))
|
||||
(if (> (* 20 (string-length input)) min-h-size)
|
||||
|
@ -92,11 +92,11 @@
|
||||
; get current time
|
||||
(define date-today (seconds->date (current-seconds) #t))
|
||||
;TODO pad the second if its only 1 character
|
||||
(define date-print (string-append (number->string (date-hour date-today))
|
||||
(define date-print (string-append (pad-date (number->string (date-hour date-today)))
|
||||
":"
|
||||
(number->string (date-minute date-today))
|
||||
(pad-date (number->string (date-minute date-today)))
|
||||
":"
|
||||
(number->string (date-second date-today))
|
||||
(pad-date (number->string (date-second date-today)))
|
||||
" | "))
|
||||
;; read, quits when user types in "quit"
|
||||
;; TODO read from GUI instead
|
||||
|
@ -1,6 +1,6 @@
|
||||
#lang racket
|
||||
|
||||
(provide displayln-safe)
|
||||
(provide displayln-safe pad-date)
|
||||
;; Several threads may want to print to stdout, so lets make things civil
|
||||
; constant always available
|
||||
(define stdout (make-semaphore 1))
|
||||
@ -22,3 +22,8 @@
|
||||
(displayln a-string)
|
||||
(semaphore-post stdout)])))
|
||||
|
||||
; adds padding to dates
|
||||
(define (pad-date date-element)
|
||||
(if (> (string-length date-element) 1)
|
||||
date-element
|
||||
(string-append "0" date-element)))
|
||||
|
Loading…
Reference in New Issue
Block a user