Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | time_keys: fix subsecond rounding bug |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a3f3d5c90ced9b73a69ff88cc965ebbc |
| User & Date: | nat 2015-04-13 18:15:46.568 |
Context
|
2015-05-02
| ||
| 14:04 | printers: add a new class-wide procedure to append strings, which often improves readibility check-in: 94f83b5035 user: nat tags: trunk | |
|
2015-04-13
| ||
| 18:15 | time_keys: fix subsecond rounding bug check-in: a3f3d5c90c user: nat tags: trunk | |
|
2015-04-11
| ||
| 21:09 | time_keys-tests: add a test showing a subsecond rounding bug check-in: d3c251409e user: nat tags: trunk | |
Changes
Changes to src/natools-time_keys.adb.
| ︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ |
| ︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
-----------------------
function To_Key
(Time : Ada.Calendar.Time;
Max_Sub_Second_Digits : in Natural := 120)
return String
is
|
| ︙ | |||
101 102 103 104 105 106 107 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | + - + + + + + |
Base := 1.0;
loop
Last := Last + 1;
Base := Base / 64.0;
N := Natural (D);
if Last = Buffer'Last or Base = 0.0 then
if N < 64 then
|
| ︙ |
Changes to src/natools-time_keys.ads.
| ︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + + + + + + + + + + + + + + + | -- This means a second granularity can be achieved with 7 characters. The -- -- most compact way of encoding such a timestamp would be counting seconds, -- -- like UNIX time. The time covered by this format is rought 2^37 seconds, -- -- which would mean 5 bytes or 7 base-64 digits (though 6 would be enough -- -- for a useful time range). -- ------------------------------------------------------------------------------ |
| ︙ |