2010-11-22 21 views

risposta

14

La risposta breve è: leggere lo System Interface section del manuale di informazioni elisp. Più in particolare, le sezioni di tempo:

La risposta più:

Emacs può lavorare con valori di tempo come stringhe, galleggianti o una tupla di due o tre numeri interi. Per esempio. chiamare alcune funzioni nel buffer *scratch*:

(current-time) 
(19689 59702 984160) 
(current-time-string) 
"Sun Nov 21 20:54:22 2010" 
(current-time-zone) 
(-25200 "MST") 
(float-time) 
1290398079.965001 

di Let alcune conversioni:

(decode-time (current-time)) 
(33 7 21 21 11 2010 0 nil -25200) 
(decode-time) ; (current-time) by default 
(51 7 21 21 11 2010 0 nil -25200) 

(let ((seconds 36) 
     (minutes 10) 
     (hour 21) 
     (day 21) 
     (month 11) 
     (year 2010)) 
    (encode-time seconds minutes hour day month year)) 
(19689 60732) 

(format-time-string "%A %e %B" (current-time)) 
"Sunday 21 November" 

(seconds-to-time 23) 
(0 23 0) 

(time-to-seconds (current-time)) 
1290399309.598342 

(time-to-days (current-time)) 
734097 

Infine, per rispondere alla tua domanda:

(time-add (current-time) (seconds-to-time 23)) 
(19689 60954 497526) 

(time-subtract (current-time) (seconds-to-time 45)) 
(19689 61001 736330) 
+0

stavo leggendo attraverso di essa, ma non ho notato la sezione Calcoli temporali, grazie! –