diff options
author | Leah Neukirchen <leah@vuxu.org> | 2019-08-15 19:23:17 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2019-08-15 19:23:17 +0200 |
commit | 440b98d2aec6789c6bb9d1c7e766428096e412e5 (patch) | |
tree | c1a6ba42fcbc60dc4660e586f4fe01bb4c111970 /notyet | |
parent | 163069ef871e57beb44c324bc166d2991b752ceb (diff) | |
download | notyet-master.tar.gz notyet-master.tar.xz notyet-master.zip |
Diffstat (limited to 'notyet')
-rwxr-xr-x | notyet | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/notyet b/notyet index 9723e8e..711c0df 100755 --- a/notyet +++ b/notyet @@ -12,6 +12,7 @@ require 'time' TODAY = Date.today NOW = Time.now +DEFER_DAYS = 14 class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children) def reindent(change) @@ -56,7 +57,7 @@ class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children) end def dateorder - if desc =~ /^(?:\(.*?\)\s*)?\[(\d\d\d\d-\d\d-\d\d)( \d\d:\d\d)?\]([+!-]?)/ + if desc =~ /^(?:\(.*?\)\s*)?\[(\d\d\d\d-\d\d-\d\d)( \d\d:\d\d)?\]([+!~-]?)/ d = Time.parse("#{$1}#{$2}") case $3 when "+", "" # todo (default) = earliest first @@ -69,6 +70,14 @@ class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children) else Float::INFINITY end + when "~" # defer, sink and raise periodically + if NOW < d + d - NOW + else + # sawtooth function + (DEFER_DAYS - + (((TODAY - d.to_date) % (2*DEFER_DAYS)) - DEFER_DAYS).abs) * 24*60*60 + end end else Float::INFINITY |