From 5d85d1b7fe6ccf72578a3c02caabd9623c16a76c Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 13 Nov 2010 18:58:36 +0100 Subject: remove with-backtrace definition; add date->timestamp * tekuti/util.scm: Remove with-backtrace definition. Add date->timestamp definition. --- tekuti/util.scm | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'tekuti') diff --git a/tekuti/util.scm b/tekuti/util.scm index 9b86a30..e7bba1c 100644 --- a/tekuti/util.scm +++ b/tekuti/util.scm @@ -34,8 +34,8 @@ call-with-temp-file emailish? urlish? date-increment date-comparator date-before? date-after? compose1 rfc822-date->timestamp timestamp->rfc822-date timestamp->atom-date - timestamp->date string-split/trimming - list-intersperse with-backtrace with-time-debugging)) + date->timestamp timestamp->date string-split/trimming + list-intersperse with-time-debugging)) (define (emailish? x) (match-bind "^([a-zA-Z0-9._+-]+)@([a-zA-Z0-9-]+\\.)+[a-zA-Z]+$" @@ -157,25 +157,6 @@ (if (null? l) (reverse dest) (loop (cdr l) (cons (car l) (cons elem dest))))))) -(define (with-backtrace* proc) - (let ((cep (current-error-port))) - (start-stack - 'with-backtrace - (with-throw-handler - #t - proc - (lambda (k . args) - (newline cep) - (format cep "Throw to `~a', args: ~s\n" k args) - (display "Backtrace:\n" cep) - (display-backtrace (make-stack #t) cep) - (newline cep)))))) - -(define-syntax with-backtrace - (syntax-rules () - ((_ form0 forms ...) - (with-backtrace* (lambda () form0 forms ...))))) - (define (gettimeofday-diff prev) (let ((now (gettimeofday))) (+ (- (car now) (car prev)) @@ -248,6 +229,9 @@ (define (timestamp->date timestamp) (time-utc->date (make-time time-utc 0 timestamp) 0)) +(define (date->timestamp date) + (time-second (date->time-utc date))) + (define (timestamp->atom-date timestamp) (date->string (timestamp->date timestamp) "~Y-~m-~dT~H:~M:~SZ")) -- cgit v1.2.3-54-g00ecf