Get the current datestamp, like "November 17, 2010 10:25:33".
The datestamp string is constructed from the values returned by
get-decoded-time$. Optionally, specify
See also universal-time, which returns an integer representation of the current time.
Function:
(defun date-fn (state zone) (declare (xargs :stobjs (state))) (declare (xargs :guard t)) (let ((__function__ 'date)) (declare (ignorable __function__)) (mv-let (second minute hour date month year day daylight-p zone-code state) (get-decoded-time$ state) (declare (ignore day)) (let ((month (nth (- month 1) '("January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December"))) (year (natstr (if (<= 0 year) year 0))) (date (natstr date)) (hour (if (< hour 10) (cat "0" (natstr hour)) (natstr hour))) (minute (if (< minute 10) (cat "0" (natstr minute)) (natstr minute))) (second (if (< second 10) (cat "0" (natstr second)) (natstr second)))) (mv (cat month " " date ", " year " " hour ":" minute ":" second (if zone (cat " " (time-zone-abbreviation zone-code daylight-p)) "")) state)))))
Theorem:
(defthm stringp-of-date.datestamp (b* (((mv ?datestamp acl2::?state) (date-fn state zone))) (stringp datestamp)) :rule-classes :type-prescription)
Theorem:
(defthm state-p1-of-date.state (implies (force (state-p1 state)) (b* (((mv ?datestamp acl2::?state) (date-fn state zone))) (state-p1 state))) :rule-classes :rewrite)