[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] using dates as property?
From: |
Samuel Wales |
Subject: |
Re: [O] using dates as property? |
Date: |
Mon, 31 Aug 2015 14:49:44 -0700 |
hi john,
documented for myself only:
(defun alpha-org-timestamp-score (&optional sg)
"Return unix minutes as a floating point number.
;;;for 0..1
;;;Beware adding this to a much larger number (around 100); you will
;;;lose resolution. Multiply first by a number with a lot of
;;;zeroes. Then add to a number with a lot of zeroes.
Seems to be unix time as 1970 (or a few hours off, possibly
depending on time zone) epoch.
This is for sorting conversations, which have an inactive
timestamp near the beginning of a header, and for all tasks.
===
There is no way to get Org to return the first ts of any type.
/fixme/ request a timestamp-any property. this gets you the
first timestamp no matter whether it is active and no matter
where it is.
This checks closed first. So the bug is if there is a ts in the
headline, closed will take precedence if it exists.
Still, this approach works OK; think of the time as always being
the time of closing for a doneish, else first ts. That is OK.
So not making the request now.
/Does not yet consider active timestamps/."
;;
;;make sure these work on any other processor or os
;;
;;(/ (org-time-string-to-seconds "1900-12-31 00:00") 60.0) nan
;;(/ (org-time-string-to-seconds "1901-12-31 00:00") 60.0) -35766300.0
;;(/ (org-time-string-to-seconds "1934-12-31 00:00") 60.0) -18409980.0
;;(/ (org-time-string-to-seconds "1960-12-31 00:00") 60.0) -4734300.0
;;(/ (org-time-string-to-seconds "1969-12-31 00:00") 60.0) -1020.0
;;(/ (org-time-string-to-seconds "1970-01-01 00:00") 60.0) 420.0
;;(/ (org-time-string-to-seconds "1980-01-01 00:00") 60.0) 5259300.0
;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10519620.0
;;(/ (org-time-string-to-seconds "2010-01-01 00:00") 60.0) 21038820.0
;;(/ (org-time-string-to-seconds "2038-01-01 00:00") 60.0) 35765700.0
;;(/ (org-time-string-to-seconds "2138-01-01 00:00") 60.0) nan
;;if you do seconds instead of minutes, it changes magnitude
;;seems ok to multiply by 1e7 or so
;;(+ 1.0 (* 10519620.0 1e8)) 1051962000000001.0 :)
;;(+ 1.0 (* 10519620.0 1e9)) 1.051962e+16 :(
;;(= (+ 1.0 (* 10519620.0 1e9)) (* 10519620.0 1e9)) t :(
;;(/ (org-time-string-to-seconds "1990-01-01 00:00") 60.0) 10,519,620.0
(let ((ts (or
;;this fixes either a doc bug or a real bug, not
;;sure which
;;
;;maybe a doc bug. all timestamps are separate?
;;then fixme if there is ever another inactive
;;timestamp type, you have to add it here.
;;
;;if so, likewise fixme you have to add all 3 active
;;timestamp types and any future ones.
(alpha-org-entry-get "CLOSED" sg)
(alpha-org-entry-get "TIMESTAMP_IA" sg))))
(aif ts
(/ (org-time-string-to-seconds it)
60.0)
0.0)))
On 8/31/15, Samuel Wales <address@hidden> wrote:
> i always put inactive timestamps in headlines, and sort both the
> outline and agenda using them. for example:
>
> ***** CONVERSATION [2015-08-31 Mon 14:41] john
> ***** CONVERSATION [2015-09-01 Tue 15:02] rms
>
> or newest first. they are visible and binary-searchable.
> works perfectly for me.
>
--
The Kafka Pandemic: http://thekafkapandemic.blogspot.com
Ramsay's disease DOES progress. MANY people have died from it. And
ANYBODY can get it.
Denmark: free Karina Hansen NOW.