Skip to content

[Fixed] Entry time is diffrent from GMT #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dayone.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
(require 'uuid)
(require 'mustache)
(require 'ht)
(require 'calc)
(require 'calc-ext)


(defgroup dayone nil
"Day One"
Expand Down Expand Up @@ -89,6 +92,15 @@ It seems that the default value works well enough."
(defun dayone-date ()
(format-time-string "%Y-%m-%dT%H:%M:%SZ" (current-time)))

(defun dayone-gmt-date ()
(format-time-string "%Y-%m-%dT%H:%M:%SZ" (seconds-to-time
(+ (string-to-number (let ((nowtime (current-time)))
(let ((high (car nowtime))
(low (cadr nowtime))
(mili (caddr nowtime)))
(math-format-number
(math-add (math-mul high (math-pow 2 16)) low))))) (* (first (current-time-zone )) -1)))))

(defun dayone-uuid ()
(uuid-string))

Expand All @@ -103,6 +115,7 @@ It seems that the default value works well enough."
(defun dayone-render-xml (uuid)
(let ((mustache-partial-paths (list dayone-template-directory))
(context (ht ("date" (dayone-date))
("date-gmt" (dayone-gmt-date))
("uuid" uuid)
("note" (dayone-note))
("timezone" dayone-timezone)
Expand Down
2 changes: 1 addition & 1 deletion layout.xml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version='1.0'>
<dict>
<key>Creation Date</key>
<date>{{ date }}</date>
<date>{{ date-gmt }}</date>
<key>Creator</key>
<dict>
<key>Device Agent</key>
Expand Down