comparison lisp/time-stamp.el @ 62402:a7e02ef1e3d6

Replace `string-to-int' by `string-to-number'.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 16 May 2005 11:33:47 +0000
parents 5c87de660fc1
children 6fb026ad601f f042e7c0fe20
comparison
equal deleted inserted replaced
62401:4512c4db6912 62402:a7e02ef1e3d6
268 (if (stringp time-stamp-pattern) 268 (if (stringp time-stamp-pattern)
269 (progn 269 (progn
270 (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(%[-.,:@+_ #^()0-9]*[A-Za-z%][^%]*\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern) 270 (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(%[-.,:@+_ #^()0-9]*[A-Za-z%][^%]*\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern)
271 (and (match-beginning 2) 271 (and (match-beginning 2)
272 (setq line-limit 272 (setq line-limit
273 (string-to-int (match-string 2 time-stamp-pattern)))) 273 (string-to-number (match-string 2 time-stamp-pattern))))
274 (and (match-beginning 3) 274 (and (match-beginning 3)
275 (setq ts-start (match-string 3 time-stamp-pattern))) 275 (setq ts-start (match-string 3 time-stamp-pattern)))
276 (and (match-beginning 4) 276 (and (match-beginning 4)
277 (not (string-equal (match-string 4 time-stamp-pattern) "%%")) 277 (not (string-equal (match-string 4 time-stamp-pattern) "%%"))
278 (setq ts-format (match-string 4 time-stamp-pattern))) 278 (setq ts-format (match-string 4 time-stamp-pattern)))
556 ((eq cur-char ?w) ;weekday number, Sunday is 0 556 ((eq cur-char ?w) ;weekday number, Sunday is 0
557 (format-time-string "%w" time)) 557 (format-time-string "%w" time))
558 ((eq cur-char ?y) ;year 558 ((eq cur-char ?y) ;year
559 (or alt-form (not (string-equal field-width "")) 559 (or alt-form (not (string-equal field-width ""))
560 (time-stamp-conv-warn "%y" "%:y")) 560 (time-stamp-conv-warn "%y" "%:y"))
561 (string-to-int (format-time-string "%Y" time))) 561 (string-to-number (format-time-string "%Y" time)))
562 ((eq cur-char ?Y) ;4-digit year, new style 562 ((eq cur-char ?Y) ;4-digit year, new style
563 (string-to-int (format-time-string "%Y" time))) 563 (string-to-number (format-time-string "%Y" time)))
564 ((eq cur-char ?z) ;time zone lower case 564 ((eq cur-char ?z) ;time zone lower case
565 (if change-case 565 (if change-case
566 "" ;discourage %z variations 566 "" ;discourage %z variations
567 (format-time-string "%#Z" time))) 567 (format-time-string "%#Z" time)))
568 ((eq cur-char ?Z) 568 ((eq cur-char ?Z)
595 (if (numberp field-result) ?d ?s)) 595 (if (numberp field-result) ?d ?s))
596 (or field-result "")))) 596 (or field-result ""))))
597 (let* ((initial-length (length padded-result)) 597 (let* ((initial-length (length padded-result))
598 (desired-length (if (string-equal field-width "") 598 (desired-length (if (string-equal field-width "")
599 initial-length 599 initial-length
600 (string-to-int field-width)))) 600 (string-to-number field-width))))
601 (if (> initial-length desired-length) 601 (if (> initial-length desired-length)
602 ;; truncate strings on right, years on left 602 ;; truncate strings on right, years on left
603 (if (stringp field-result) 603 (if (stringp field-result)
604 (substring padded-result 0 desired-length) 604 (substring padded-result 0 desired-length)
605 (if (eq cur-char ?y) 605 (if (eq cur-char ?y)
619 (and (not alt-form) (string-equal field-width "") 619 (and (not alt-form) (string-equal field-width "")
620 (time-stamp-conv-warn format-string 620 (time-stamp-conv-warn format-string
621 (format "%%:%c" format-char))) 621 (format "%%:%c" format-char)))
622 (if (and alt-form (not (string-equal field-width ""))) 622 (if (and alt-form (not (string-equal field-width "")))
623 "" ;discourage "%:2d" and the like 623 "" ;discourage "%:2d" and the like
624 (string-to-int (format-time-string format-string time))))) 624 (string-to-number (format-time-string format-string time)))))
625 625
626 (defvar time-stamp-conversion-warn t 626 (defvar time-stamp-conversion-warn t
627 "Warn about soon-to-be-unsupported forms in `time-stamp-format'. 627 "Warn about soon-to-be-unsupported forms in `time-stamp-format'.
628 If nil, these warnings are disabled, which would be a bad idea! 628 If nil, these warnings are disabled, which would be a bad idea!
629 You really need to update your files instead. 629 You really need to update your files instead.