Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7752483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:48:43+00:00 2026-06-01T11:48:43+00:00

I inherited a TCL script (I have zero familiarity with the language) and need

  • 0

I inherited a TCL script (I have zero familiarity with the language) and need to add an RFC 3339 timestamp to it:

2012-04-05T12:13:32.123456-08:00

After searching Google, I haven’t found any means of displaying the microseconds or the timezone offset (I have found a way to show the timezone name, but that doesn’t help).
Is there a way to do this without calling an external process?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:48:44+00:00Added an answer on June 1, 2026 at 11:48 am

    In TCL8.5, you can try the following command:

    % clock format [clock seconds] -format "%Y-%m-%dT%T%z"
    2012-04-05T16:06:07-0500
    

    That gives you everything except the sub-second resolution. The clock microseconds command will give you the time in microseconds, but I can’t find a format string identifier that matches it. You can use this to build your own command from scratch:

    proc timestamp_rfc3339 {} {
        set us [clock microseconds]
        set sec [expr {$us / 1000000}]
        set micro [expr {$us % 1000000}]
        set ts [clock format $sec -format "%Y-%m-%dT%T"]
        regexp {(...)(..)} [clock format $sec -format "%z"] matched tzh tzm
        return [format "%s.%06s%s:%s" $ts $micro $tzh $tzm]
    }
    

    Running this results in a timestamp like 2012-04-05T16:35:06.366378-05:00.

    Edit: Updated code sample to incorporate user1179884’s tweaks (see comments) and to wrap in a proc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I inherited a script running on Windows Server 2003 that I need to port
I inherited this code and now need to make modifications. I have a series
I inherited a shell-script application that is a combination of kshell scripts, awk, and
I inherited a flash project from someone and if I add a simple movie
I inherited an existing Ant build script. It invokes javac three times on three
I inherited a simple C# project without a App.config file. I need it now.
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I inherited a database from an old system we have, in which (among other
I inherited my scene from QGraphicsScene. I add many items(QGraphicslineItem, QGraphicsItem, QGraphicsTextItem) on this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.