aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Hermes/GUI.rkt2
-rw-r--r--Hermes/client.rkt6
-rw-r--r--Hermes/modules/general.rkt7
3 files changed, 10 insertions, 5 deletions
diff --git a/Hermes/GUI.rkt b/Hermes/GUI.rkt
index 6f3dc9a..7780e28 100644
--- a/Hermes/GUI.rkt
+++ b/Hermes/GUI.rkt
@@ -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)
diff --git a/Hermes/client.rkt b/Hermes/client.rkt
index 197485e..ae1354c 100644
--- a/Hermes/client.rkt
+++ b/Hermes/client.rkt
@@ -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
diff --git a/Hermes/modules/general.rkt b/Hermes/modules/general.rkt
index b33eb8a..76ceaf4 100644
--- a/Hermes/modules/general.rkt
+++ b/Hermes/modules/general.rkt
@@ -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)))