IronCoreLabs / ironhide

Tool to easily encrypt and decrypt files to users and groups. Similar to GPG, but usable at scale.
GNU Affero General Public License v3.0
44 stars 6 forks source link

Simplify timestamp formatting #84

Closed Kijewski closed 1 year ago

Kijewski commented 1 year ago

This PR makes the tool use tz-rs to convert a timestamp to the user's local time zone, and respect changes to their DST since the creation of a device. The relevant time zone designation is printed in the resulting string.

This PR further removes the usage of unwrap() from formatting a timestamp. On error Debug::fmt() is used to express the timestamp.

And lastly the PR makes divining the user's timezone lazy and caching.

Resolves #82 Resolves #83

Kijewski commented 1 year ago

I'm not actually a user of this fine tool, so the PR is totally untested. :)

skeet70 commented 1 year ago
+--------------+-------+--------+----------------------------------+---------------------------+---------------------------+
| Group Name   | Admin | Member | Group ID                         | Created                   | Updated                   |
+--------------+-------+--------+----------------------------------+---------------------------+---------------------------+
| test-group   | ✓     | ✗      | f3def3ae7103263736d2bfcbfdf0b69a | 2022-04-14 15:30:33 (MDT) | 2022-10-27 12:31:15 (MDT) |
+--------------+-------+--------+----------------------------------+---------------------------+---------------------------+
| test-group^2 | ✓     | ✓      | e3fd3372bdb1c5dfe2ba8c6ead1fa253 | 2022-04-14 16:51:52 (MDT) | 2022-04-14 16:51:52 (MDT) |
+--------------+-------+--------+----------------------------------+---------------------------+---------------------------+
+---------+------------------------------------+
| Group   | test-group                         |
+---------+------------------------------------+
| Admin   | ✔                                  |
+---------+------------------------------------+
| Member  | ✖                                  |
+---------+------------------------------------+
| Created | 2022-04-14 15:30:33 (MDT)          |
+---------+------------------------------------+
| Updated | 2022-10-27 12:31:15 (MDT)          |

Works, and thanks, we appreciate the help!