Documentation and code for manipulating sleep diaries
A lot of software records the moment or time period where an event happens. For example, your calendar has start and end times for events; and your browser cache stores the time you visited each page. Activity Log Format is a standardised way of representing these logs, so we can guess your sleep times by seeing when no events occurred.
Activity Logs requires some technical skill to produce and are often inaccurate. If you have the choice, it is better to avoid this format.
You may find the following useful:
The preprocessor is not distributed as part of the JavaScript library. Implementors are expected to copy or replicate it into their own programs.
Here is an example activity log:
maximum_day_length_ms=129600000
ActivityStart,ActivityEnd
2016-08-04T02:01:00Z,1234567890
2013-08-05T03:02:01Z,1073741824
An activity log contains three sections:
settings
- optional line to configure the way activities are processedheader
- exactly one line matching Activity started,Activity ended
records
- one or more lines containing pairs of datesEach setting must be present at most once. Setting lines must match the regular expression /^[a-z_]+=[0-9]+$/
. At present, only one setting is used:
maximum_day_length_ms
: when activities are converted to records, ensure no day can be more than this many milliseconds (default: 32 hours)Each record specifies the time when an activity began and ended. Records should be in one of the following times:
2002-10-01T12:34:56Z
Some other formats may be processed correctly, although this depends on your browser.
Unix times measured in seconds must be after 01:46:40 UTC on 9 September 2001 (1,000,000,000 seconds since the epoch).
Here is a rough description of the way activities are converted to statuses:
maximum_day_length_ms
ahead