Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

High resolution time #7

Open
georgalis opened this issue Feb 27, 2018 · 1 comment
Open

High resolution time #7

georgalis opened this issue Feb 27, 2018 · 1 comment

Comments

@georgalis
Copy link

Feature request: Would like to use pgfgantt to visualize events with more precise time alignment. An input of unix seconds as the date, for example would allow study of events and their alignment. Similarly, I would like to visualize multi-year or multi-century events to see their overlap or diagram their relations. (for example use pgfgantt to draw a map of arbitrary events in a database for comparison of their relation in time)

Seems like I could cheat by using days as seconds and derive a function to calculate decimals thereof, and come up with appropriate labeling, but I expect that would cause some out of bounds issues and there must be a better way.

My application uses 8 hexadecimal bytes to represent unix seconds (eg now is 5a95b8e7. Would be amazing if I could use that number directly to identify time in charts. Thank you!

@georgalis
Copy link
Author

Here are some additional details, my original feature request may have greater utility and be easier to implement then the request suggest...

My interest in pgfgantt revolves around visually analyzing events in a knowledge base, which uses the tai64n time standard as event, or acquisition demarcation. The result is high precision, easy span calculations, and easy conversion to human formats with system tools (tai64n and UNIX handle leap seconds differently, but that is a non-issue since you can offset at the time of human conversion, all calculations are done in the tai64n format). Which is to say tai64n works great as a time standard, you can use date or tai64nlocal commands for human conversion, and never fuss with human time calculations.

More specifically, my feature request is to see pgfgantt simply (or optionally) operate with integer (time position and span) and arbitrary label inputs. This completely bypasses the complexities of latex time format conversion programming, that information can be easily calculated prior to invocation, and provided as input parameters.

This script https://github.com/georgalis/pub/blob/master/boot/nbsd/tai64n-inst.sh downloads and compiles just the tai64n and tai64nlocal programs from the DJB public domain software http://cr.yp.to/daemontools/tai64n.html (on linux use wget vs ftp). Here is some invocation example, the tai64n program is designed to prepend timestamps to stdin log entries, while tai64nlocal converts the format to human.

1) a=$(date "+%s" | tai64n)
1) echo $a
@40000000629f7bef366e883c 1654619109

2) b=$(echo $a | sed -e "s/^@[[:xdigit:]]\{8\}/& /" -e 's/ [[:xdigit:]]\{8\}/& /')
2) echo $b
@40000000 629f7bef 366e883c 1654619109

3) set $b
3) echo $(( 0x$2 - $4 ))
10

4) date -r $(( 0x$2 ))
Tue Jun  7 09:25:19 PDT 2022

5) echo $a | tai64nlocal
2022-06-07 09:25:09.913213500 1654619109

Programming time format conversions in the rendering tool was also attempted by the https://github.com/mermaid-js effort, which is an alternative to pgfgantt, however due to (security) implementation concerns, I would only consider that option implemented as a docker service... the ability to render gantt graphics from integer time series input data with arbitrary label inputs, would greatly expand the utility of pgfgantt, and the latex workflow would be far more convenient, and easy to use.

I have used the TikZ and pgfgantt macros, but have not programmed significant latex macros, although implementing this feature may be relatively straightforward, I appreciate "getting into it" might be a significant effort. At some point I may take a closer look.

I would love to convert the tool to enable integer time-frames and scale labels as input parameters!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant