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
|
(send dc draw-text input 0 height) ;; just print message to string
|
||||||
|
|
||||||
(set! listy (appendlist listy (list username input color height)))
|
(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
|
; redraw overly long text on gui
|
||||||
(set! min-v-size (+ min-v-size 15))
|
(set! min-v-size (+ min-v-size 15))
|
||||||
(if (> (* 20 (string-length input)) min-h-size)
|
(if (> (* 20 (string-length input)) min-h-size)
|
||||||
|
@ -92,11 +92,11 @@
|
|||||||
; get current time
|
; get current time
|
||||||
(define date-today (seconds->date (current-seconds) #t))
|
(define date-today (seconds->date (current-seconds) #t))
|
||||||
;TODO pad the second if its only 1 character
|
;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"
|
;; read, quits when user types in "quit"
|
||||||
;; TODO read from GUI instead
|
;; TODO read from GUI instead
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
(provide displayln-safe)
|
(provide displayln-safe pad-date)
|
||||||
;; Several threads may want to print to stdout, so lets make things civil
|
;; Several threads may want to print to stdout, so lets make things civil
|
||||||
; constant always available
|
; constant always available
|
||||||
(define stdout (make-semaphore 1))
|
(define stdout (make-semaphore 1))
|
||||||
@ -22,3 +22,8 @@
|
|||||||
(displayln a-string)
|
(displayln a-string)
|
||||||
(semaphore-post stdout)])))
|
(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