Mercurial > core / lisp/lib/obj/time/util.lisp
changeset 698: |
96958d3eb5b0 |
parent: |
7845348eced6
|
author: |
Richard Westhaver <ellis@rwest.io> |
date: |
Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: |
-rw-r--r-- |
description: |
fixes |
1 ;;; util.lisp --- Time Utils 8 ;; from hunchentoot/util.lisp - these variants are more portable than the 9 ;; local.lisp alternatives. 10 (defun rfc-1123-date (&optional (time (get-universal-time))) 11 "Generates a time string according to RFC 1123. Default is current time. 12 This can be used to send a 'Last-Modified' header - see 13 HUNCHENTOOT::HANDLE-IF-MODIFIED-SINCE." 15 (second minute hour date month year day-of-week) 16 (decode-universal-time time 0) 17 (format nil "~A, ~2,'0d ~A ~4d ~2,'0d:~2,'0d:~2,'0d GMT" 18 (svref +day-names+ day-of-week) 20 (svref +month-names+ (1- month)) 26 (defun iso-time (&optional (time (get-universal-time))) 27 "Returns the universal time TIME as a string in full ISO format." 28 (multiple-value-bind (second minute hour date month year) 29 (decode-universal-time time) 30 (format nil "~4,'0d-~2,'0d-~2,'0d ~2,'0d:~2,'0d:~2,'0d" 31 year month date hour minute second)))