Version 41 of Star Trek

Updated 2013-12-26 06:25:34 by AMG

A sci-fi TV show, later turned into a long movie sequel.

Mentioned here for some obscure reason. Maybe they used Tcl in the Enterprise...

...it turns out that Tcl's [clock scan] supports Star Trek's stardate notation:

 % clock scan "stardate 20 . 20"
 -756604800

I've no idea who added this or why. I cannot see it in the documentation either. Strikes me as needless code bloat. Does *anyone* use this?

RS Also:

 43258 % clock format [clock sec] -format %Q
 Stardate 57824.5

RJ further embarasses himself by adding that the above Next Generation stardate is actually the stardate for the current date in the 24th century. For some reason, the author chose to do this. The "57" refers to 57 years since the base year 2323 (known as year zero.) The current stardate would be a negative value otherwise. Jeez, I hate that I know this.


TK Version:

 #!/usr/bin/env wish

 # see: http://wiki.tcl.tk/9832

 package require Tk

 proc sleep {time} {
     global end
     after $time set end 1
     vwait end
 }

 proc setTime {} {
     global time clicks
     set time [clock format [clock sec] -format %Q]
     set current [clock format [clock sec] -format {-%m-%d %H:%M:%S}]
     set year [expr [clock format [clock sec] -format {%Y}] + 377]
     set clicks $year$current 
 }

 setTime

 label .l -textvariable time
 label .m -textvariable clicks
 pack .l
 pack .m

 while {true} {
     sleep 1000
     setTime
 }

---

The source for "strftime.c" reveals that the undocumented %Q format specifier is done as a special case:

    /* ... from strftime.c ... */
    if (format[0] == '%' && format[1] == 'Q') {
        /* Format as a stardate */
        sprintf(s, "Stardate %2d%03d.%01d",
                (((t->tm_year + TM_YEAR_BASE) + 377) - 2323),
                (((t->tm_yday + 1) * 1000) /
                        (365 + IsLeapYear((t->tm_year + TM_YEAR_BASE)))),
                (((t->tm_hour * 60) + t->tm_min)/144));
    /* ... */

 (bin) 50 % clock format [clock sec] -format "%Q blah"
 Stardate 57547.3
 (bin) 51 % clock format [clock sec] -format " %Q blah"
  Q blah

Anyone know who/when/why introduced this curious feature?

Just before the Tcl/2k conference in Austin - ask Jeff Hobbs and/or Kevin Kenny...

Ro: This is really neat ;)


I believe the option was named %Q because of the Star Trek Next Generation recurring character of Q of the Q Consortium...

AMG thinks it's actually the Q Continuum.

"My name's Q. That's short for Q."


Maybe it was in honour of Scotty:

What is Scotty? Scotty is the name for a software package which allows to implement site specific network management software using high-level, string-based APIs. The software is based on the Tool Command Language (Tcl) which simplifies the development of portable network management applications. The scotty source distribution includes two components: The Tnm Tcl extension allows to access network management information. The Tkined network editor provides a framework for an extensible network management platform.

What is the story behind the name Scotty? Some people say it has something to do with the startrek series. Scotty was the character who had to make the impossible possible in order to keep the starship flying and the scotty package may do the same for your network. Others say that this name happened by accident because the author of the Scotty package was just too lazy to come up with a better name...


Or maybe it was in honor of George Takei, pronounced "Tk," who played Sulu on Star Trek.


LES: Although the %Q option works in 8.4, it is not documented in 8.4. It is documented in 8.5, but the text sort of dodges the issue: "This format group is reserved for internal use within the Tcl library." In other words, "we acknowledge the existence, but don't feel like talking about it."


KBK: To quote Beauregard Claghorn[L1 ]: "It's a joke, son! Joke, that is. Pay attention son! (Kid's about as smart as a bag full o'wet mice)." The idea at the time was that Tcl was being pitched as "Enterprise Ready."

[L2 ]

DG: Beauregard? Your quote rang out more like Foghorn Leghorn[L3 ] to me ;) "A chicken hawk, eh? Over there's your chicken."

http://upload.wikimedia.org/wikipedia/en/a/a0/Foghorn_Leghorn.png

escargo 19 Sep 2005 - I added Wikipedia[L4 ] links to Claghorn and Foghorn above. The Wikipedia entries mentioned the irony of Foghorn remaining known, and Claghorn (the original being spoofed) becoming lost in the mists of time. It's probably not the only case in cartoon history.


etdxc This is another of those features that make me love the language. I used to love to find this sort of thing in Unix termcaps. I need therapy.


MrStonedOne: as far as i can tell its the time since Tue May 12 00:00:00 GMT 1835 in the format of

(days).(time in the format of tenths of a day):

clock format clock sec -format %Q (Stardate 63665.1)

clock scan "63665 days ago" -gmt 1(-4248892800)

clock format -4248892800 -gmt 1(Tue May 12 00:00:00 GMT 1835)

Does anyone know anything that happened on that date that relates to a programmer or star trek or scifi?

LV While I don't know the answer to this question, I did run across http://trekguide.com/Stardates.htm while googling the subject of calculating stardates similar to the Trek universe.


al - 2009-09-07 01:18:14

Apparently, a letter dated April 27, 1835 from Charles Babbage to Adolphe Quetelet has been identified as the earliest known reference to the Analytical Engine. One may speculate that Quetelet received the letter in May?

This may be merely coincidental.