-
Notifications
You must be signed in to change notification settings - Fork 64
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
DateTime: use strftime('%H %M', 0) on Windows #578
Conversation
let item = split(strftime('%c', 0), ' ') | ||
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 | ||
if item[0] !~ '^1970' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vint] reported by reviewdog 🐶
Use robust operators !~#
or !~?
instead of !~
(see Google VimScript Style Guide (Matching))
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 | ||
if item[0] !~ '^1970' | ||
return printf('-%02d%02d', hms[0], hms[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong.
return s:win_tz | ||
let item = split(strftime('%c', 0), ' ') | ||
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vimlint] reported by reviewdog 🐶
EVL102: unused variable l:tz_sec
let item = split(strftime('%c', 0), ' ') | ||
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 | ||
if item[0] !~ '^1970' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vint] reported by reviewdog 🐶
Use robust operators !~#
or !~?
instead of !~
(see Google VimScript Style Guide (Matching))
let item = split(strftime('%c', 0), ' ') | ||
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 | ||
if item[0] !~ '^1970' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vint] reported by reviewdog 🐶
Use robust operators !~#
or !~?
instead of !~
(see Google VimScript Style Guide (Matching))
let item = split(strftime('%c', 0), ' ') | ||
let hms = map(split(item[1], '[^0-9]'), 'str2nr(v:val)') | ||
let tz_sec = hms[0] * 60 * 60 + hms[1] * 60 | ||
if item[0] !~ '^1970' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[vint] reported by reviewdog 🐶
Use robust operators !~#
or !~?
instead of !~
(see Google VimScript Style Guide (Matching))
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 つ目のコミットメッセージの DateTime:
が Datetime:
になってしまっているので直してほしいです。ひとまとめにしてもらっちゃっても大丈夫です。
let l:tz_sec = 60 * 60 * 24 - l:tz_sec | ||
return printf('-%02d%02d', l:tz_sec / 60 / 60, (l:tz_sec / 60) % 60) | ||
endif | ||
return printf('+%02d%02d', l:hms[0], l:hms[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vital では l:
なしに統一しているので合わせてもらえると 🙏
let hm = map(split(strftime('%H %M', 0), ' '), 'str2nr(v:val)') | ||
if str2nr(strftime('%Y', 0)) != 1970 | ||
let tz_sec = hm[0] * s:NUM_SECONDS * s:NUM_MINUTES + hm[1] * s:NUM_SECONDS | ||
let tz_sec = s:NUM_SECONDS * s:NUM_MINUTES * s:NUM_HOURS - tz_sec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s:SECONDS_OF_DAY
が便利そう。
return s:win_tz | ||
let hm = map(split(strftime('%H %M', 0), ' '), 'str2nr(v:val)') | ||
if str2nr(strftime('%Y', 0)) != 1970 | ||
let tz_sec = hm[0] * s:NUM_SECONDS * s:NUM_MINUTES + hm[1] * s:NUM_SECONDS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s:SECONDS_OF_HOUR
が便利な予感。
if str2nr(strftime('%Y', 0)) != 1970 | ||
let tz_sec = hm[0] * s:NUM_SECONDS * s:NUM_MINUTES + hm[1] * s:NUM_SECONDS | ||
let tz_sec = s:NUM_SECONDS * s:NUM_MINUTES * s:NUM_HOURS - tz_sec | ||
return printf('-%02d%02d', tz_sec / s:NUM_SECONDS / s:NUM_MINUTES, (tz_sec / s:NUM_SECONDS) % s:NUM_MINUTES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
実はここも hour の方は tz_sec / s:SECONDS_OF_HOUR
で行ける可能性。
テスト通った 🎉 |
あ、Approve したけどコミットメッセージがまだ直ってませんでした。
|
squash してコミットメッセージ変えた方が良さそうです? |
あー、最初のコミットの事でしたか。 |
Current implementation on Windows use Windows registory since %z on Windows return '東京 (標準時)'. But it is bit slow. strftime('%c', 0) must be epoch based on 1970/1/1 0:0:0, so hours and minutes must be time offset.
ありがとうございます! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🍣
ついでにPreludeも依存から消せるかな、と思って全体みたらめっちゃ使ってた。
とりあえずこのpullreqはもうマージしちゃいたいですね!
Current implementation on Windows use Windows registory since %z on Windows return '東京 (標準時)'. But it is bit slow. strftime('%c', 0) must be epoch based on 1970/1/1 0:0:0, so hours and minutes
must be time offset.