Do you have a better solution how to convert today's dates to Stardate? Is there any agreed on (by fans, anyways) standard that I simply missed?

https://doughnut.neocities.org/blag/19

Captain's log, stardate -2977420.6

@bugbear

Oooh, neat question! I remember pondering this when I was a teenager in the 90s.
I actually realized early on that the standard ISO date format is the best: YYYY-MM-DD (although I didn't use hyphens at the time, as stardates don't have hyphens), and started using YYYYMMDD for my digital diary way back then (long lost, sadly, or maybe not SO sadly, if you knew me as a teenager, lol)

But the canonical system of #Stardate as of the TNG era was 40000 + 1000 * season_number + "day", where the "day" was something like (day_of_year / 365 * 999)

So, since season 1 was 1987, the "current" stardate would be something like 2025-1987 + 41 = 79000

As far as the non-sequential order of TOS stardates goes, this is because NBC did not air the episode in the order they were made. They were produced sequentially, but not aired sequentially.

The other problem is that the stardates are tied to the beginning of TNG seasons (in the fall), and not the beginning of calendar years. That makes things more difficult, but I guess the best solution would be to use the number of days since Encounter at Farpoint aired? (1987-09-28)

Here's what I came up with using bash, bc (which you may need to install) and awk:

$ echo "( $(date +%s) - $(date +%s -d 1987-09-28) ) / 365.25 / 24 / 3600 * 1000 + 41000" |bc -l |awk '{printf "%.1f\n", $1}' 78967.2

@amin

@rl_dane @bugbear @amin I just have to give props here for the use of bc and awk. I feel young again :).

@nazgul @bugbear @amin

This is the way!

@rl_dane
Now do a version using dc instead of bc! 😈
@nazgul @bugbear @amin

@ddlyh @nazgul @bugbear @amin

It's just an RPN version of bc, right?

@ddlyh @bugbear @amin @nazgul @rl_dane it’s the bc backend in BSD, bc is just a prƦprocessor that produces dc commands, so the conversation is a no-brainer

@rl_dane @nazgul @amin @bugbear drop the -l though unless you actually need to load the math library

(I use bc lots…)

@nazgul @bugbear @rl_dane @amin oh, and, you need to set the scale first or multiply first; by default, a real bc will give you integers

@mirabilos @nazgul @amin @bugbear

How do you set the decimal precision without -l? I'm a total noob.

@rl_dane @nazgul @amin @bugbear -l just loads the library (for sinus, etc). You need set the scale, even if you load the library.

RTFM bc(1), dc(1), 06.bc(USD), 05.dc(USD)

RTFM bc(1)

RTFM

xkcd
@amin @rl_dane @nazgul @bugbear I was just teaching him to fish, with good quality reference material (not the GNU nincompoop)

@mirabilos @rl_dane @nazgul @bugbear

Yeah, I just couldn't resist the reference; I don't get to cite that one often. ;)

@amin @mirabilos @nazgul @bugbear

Telling someone with #ADHD to #RTFM is practically a prelude to war. XD

Of course, the paradox is that we can RTFM better than anyone... when our brains want to.

@rl_dane @amin @nazgul @bugbear just /-l in it, it even has a tiny tiny table with the functions loaded

And read some of it for deeper understanding. Then shudder… before the beautiful.

(E-Guitar riff here.)

@rl_dane @amin @nazgul @bugbear (though I just noticed that it’s apparently normal that loading the math lib sets the scale to 20)

As to the original problem:

# inlining 559785600=$(date +%s -ud 1987-09-28) # to stay portable to systems without GNU date printf '%s\n' \ 'scale=9' \ "v=($(date +%s) - 559785600) * 1000 / 60 / 60 / 24 / 365.2425" \ scale=1 '(v+.05)/1' | bc

This even solves the rounding, no need to awk around.

Tbh it’s ugly, and I’d rather just define the generic-correct bc rounding function first, then just use it:

bc <<EOF define r(x,n) { auto o o = scale if (scale < (n + 1)) scale = (n + 1); /* assume sign is positive instead of getting the sign first x += v(x) * 0.5 * A^-n */ x += 0.5 * A^-n scale = n x /= 1 /* drop trailing zeroes */ /* commented out for this use case for (scale = 0; scale <= o; scale++) { if (x == x/1) { x /= 1 break } } */ scale = o return (x) } scale=9 r(($(date +%s) - 559785600) * 1000 / 60 / 60 / 24 / 365.2425, 1) EOF

I commented out stuff that requires use of a separate function to get the sign…

define v(x) { if (x < 0) return (-1) if (x > 0) return (1) return (0) }

… and that removes trailing 0s at the end asuming you always want d+.d precision for your ā€œstar datesā€.

@rl_dane @amin @nazgul @bugbear (fwiw, these functions come from my ā€œmusical tuningā€ script which I sadly not finished yet as the maths involved is sometimes a bit too mind-boggling)

@mirabilos @amin @nazgul @bugbear

That is... a lot more complex than just calling bc -l ;)

@rl_dane @amin @nazgul @bugbear … and spawning awk.

@mirabilos @amin @nazgul @bugbear

I'm willing to call another fork() for the sake of simplicity, especially when it's not in a loop.

@bugbear @nazgul @amin @rl_dane I find awk anything but simple

@mirabilos @bugbear @nazgul @amin

I mean, it's a full programming language in its own right, of course, and I'm using it in probably the dumbest way, but for all its internal complexity, it performs this one simple job very well.

ĀÆ\_(惄)_/ĀÆ

@rl_dane @bugbear @nazgul @amin so’s bc(1)
@rl_dane @bugbear @nazgul @amin bc|awk is like python3 -c 'print 1+1' | awk to format the decimals

@mirabilos @bugbear @nazgul @amin

lol, ROASTED

Someone flip me over and put marshmallows on my back or something. 🤣

@rl_dane @amin @mirabilos @nazgul @bugbear this response always confused me. If it’s such a pain in the rear to reply to the question that you have to abbreviate your refusal to respond with a ā€œyou should never have asked this questionā€ then like don’t respond? Ignore it? Why be mean?
@samd @rl_dane @amin @nazgul @bugbear it’s not a refusal, it’s an indication that this is well-documented, and I know RL Dane is capable of these acronyms and manpages ;)

@samd @rl_dane @mirabilos @nazgul @bugbear

Well in theory at least the response could evoke a change in behavior that prevents future interruptions of this nature.

@bugbear @samd @nazgul @rl_dane @amin and I did link to the relevant ones

@mirabilos @bugbear @samd @nazgul @amin

Ah, silly @tut not showing links. XD

@rl_dane @bugbear @samd @nazgul @amin @tut it should try to underline them, at least, maybe patch it locally?

@mirabilos @bugbear @samd @nazgul @amin @tut

@sunarch is working on a replacement, also written in #Issue9. I was involved with initial discussions, but had to escort myself out of the room, so to speak, because I had way too many intense things going on in my life.

@tut @bugbear @rl_dane @samd @nazgul @sunarch @amin sure but maybe you can cobble together a quick local fix for it since it affects you since months
@mirabilos @tut @bugbear @rl_dane @samd @nazgul @amin We are slowly marching on, but still initial phases:) Feel free open issues with (even personally) important features, and we'll try to prioritize including those if possible.
@rl_dane @amin @mirabilos @nazgul @bugbear Dood just read the docz...

@mirabilos @nantucketlit @amin @nazgul @bugbear

Not dead, "dood" (dude). ;)

@rl_dane @nantucketlit @amin @nazgul @bugbear ā€œdoodā€ is nederlands vor dood, zo…
English to Dutch Translations | Know Your Meme

English to Dutch Translations, also associated with the catchphrase Dutch Is Not a Serious Language, refers to comical translations of English phrases to D

Know Your Meme
@rl_dane @nantucketlit @amin @nazgul @bugbear my throat agrees, but I could not help and had to parse that sentence as dutch with embedded english

@mirabilos @nantucketlit @amin @nazgul @bugbear

I still hear Dutch speakers as "this is what American English would sound like to me if I didn't know English, but with an occasional "kh" sound" ;)

@amin @nazgul @rl_dane @bugbear @nantucketlit it varies a lot; the "barok" radio I’m currently listening to’s moderation consists almost wholly of throat sounds with an occasional comprehensible word or two thrown in.

I learn languages by reading/writing, which makes this… challenging.

@mirabilos @amin @nazgul @bugbear @nantucketlit

> I learn languages by reading/writing, which makes this… challenging.

I've often wondered if Korean couldn't be the easiest Asian language to learn, as its writing system (Hangul) is very easy to learn.

@amin @rl_dane @bugbear @nazgul @nantucketlit lots and lots of homoglyphs due to the history of ideographs.

Cymraeg seems nice. No silent letters like Gaelic, and the pronunciation (once you get w and y sorted and remember u is i) is totally straightforward, with a bit of difference between N/S Wales.

@mirabilos @amin @bugbear @nazgul @nantucketlit

That's interesting! I once saw an experiment of mutual intelligibility on YT between a Welsh and Irish (I think) Gaelic speaker, and it was pretty fascinating.

The two languages did sound similar to my (completely untrained) ears, but they had a lot of difficulty understanding each other. As I recall, they had a lot of shared cognates, but not so much a 1:1 between words.

@nantucketlit @nazgul @rl_dane @amin @bugbear they are each other’s closest relative on the indoeuropean language tree, yes

@rl_dane @mirabilos @nantucketlit @amin @nazgul @bugbear

Dutch is like if a german and english got into a carcrash, and then you throw in half of a scandinav in there for some extra spice, it's a really funny language for me, and kind of annoying, because I can halfway understand it if I focus, and otherwise it's just weird gibberish.

@sotolf @amin @rl_dane @nantucketlit @nazgul @bugbear there’s also lots of variety, even if you exclude honestly different languages like Limburgish, flames from the east and west side of Belgium speak with each other in English because their Dutch variants are not sufficiently mutually intellegible…

Belgium is like three hours by car or high-speed train wide.

@mirabilos @amin @rl_dane @nantucketlit @nazgul @bugbear

I've only actually been in Belgium, but I find it kind of hard to believe that they are that inflexible, we have about ~400 or so Norwegian dialects with differences in everything, grammar, words, tone difference, accent, and so on, to the point that some swedish dialects for example are easier for me to understand than the ones of my country men, but we don't really do the english thing, because even with Norwegian which doesn't have a standard spoken language, you usually end up slowly approximating each other until you get to a middle point where both parts understand.

I mean unless they just are too lazy to actually try that is :p

@mirabilos @amin @rl_dane @nantucketlit @nazgul @bugbear

But then I don't really envy people wanting to learn the language when I look at some conjugation tables, here are the most common but not all, personal pronouns and possessive pronouns in common use:

@sotolf @mirabilos @amin @nantucketlit @nazgul @bugbear

That reminds me of this gem... XD

@rl_dane @mirabilos @amin @nantucketlit @nazgul @bugbear Hah, yeah finnish conjugations is something for itself :D

@rl_dane @sotolf @mirabilos @nantucketlit @nazgul @bugbear

Heh, I’ve seen this. A highschool friend of mine loved these comics. Drew some of his own, too.

@amin @sotolf @mirabilos @nantucketlit @nazgul @bugbear

I think I saw it nearly 10 years ago, so sounds about right. ;)

@rl_dane @bugbear @amin

EDIT: this is erroneous, see correction later in thread

If you want to evade bc you can do this in pure awk (and the bash date, dealing with dates in awk is not fun) like this

echo '' | awk -v season="$(date +%s) - $(date +%s -d 1987-09-28)" '{printf "%.1f\n", season / 365.25 / 24 / 3600 * 1000 + 41000}'

@rl_dane @bugbear @amin

EDIT: this is erroneous, see correction later in thread

Actually this also works because awk just throw away what you pipe into it here, it's just there to not loop it over stdin really.

1 | awk -v season="$(date +%s) - $(date +%s -d 1987-09-28)" '{printf "%.1f\n", season / 365.25 / 24 / 3600 * 1000 + 41000}'