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

  • Home
  • SEARCH
  • 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 7811325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:07:11+00:00 2026-06-02T04:07:11+00:00

I’ve found this script on the internet. It’s a bit old, and the developers

  • 0

I’ve found this script on the internet. It’s a bit old, and the developers page is long gone. The code works, but I’m trying to clean it up a bit. For example: If weeks = 0, then don’t display it. I’m getting errors from the console about extra tokens. I’ve tried to google this error, but nothing solid is coming up. Looking for some insight.

The commented section is my attempt at “cleaning it up”. Here’s the error I’m receiving.

Tcl error [uptime]: syntax error in expression “$::time(week) = 0”: extra tokens at end of expression

With the section commented, it works fine. Just trying to clean things up so it doesn’t return “I’ve been online for 0 weeks 0 days 0 hours 1 minute”.

bind pub "-|-" !uptime uptime
proc uptime { nick host handle channel text } {

putquick "PRIVMSG $channel :I have been online for [eggtime]."

}

proc eggtime {} {
  set ::time(uptime) [expr [clock seconds]-$::uptime]
  set ::time(week) [expr $::time(uptime)/604800]
  set ::time(uptime) [expr $::time(uptime)-$::time(week)*604800]
  set ::time(days) [expr $::time(uptime)/86400]
  set ::time(uptime) [expr $::time(uptime)-$::time(days)*86400]
  set ::time(hour) [expr $::time(uptime)/3600]
  set ::time(uptime) [expr $::time(uptime)-$::time(hour)*3600]
  set ::time(mins) [expr $::time(uptime)/60]
  set ::time(uptime) [expr $::time(uptime)-$::time(mins)*60]
  set ::time(secs) $::time(uptime)


#if {$::time(week) = 0} {
#  set ::time(return) "$::time(days) day\(s\), $::time(hour) hour\(s\), $::time(mins) minute\(s\) and $::time(secs) second\(s\)"
#} else if {$::time(days) = 0} {
#  set ::time(return) "$::time(hour) hour\(s\), $::time(mins) minute\(s\) and $::time(secs) second\(s\)"
#} { 
#  set ::time(return) "$::time(week) week\(s\), $::time(days) day\(s\), $::time(hour) hour\(s\), $::time(mins) minute\(s\) and $::time(secs) second\(s\)"
#}

  set ::time(return) "$::time(week) week\(s\), $::time(days) day\(s\), $::time(hour) hour\(s\), $::time(mins) minute\(s\) and $::time(secs) second\(s\)"

  return $::time(return)
}
  • 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-02T04:07:13+00:00Added an answer on June 2, 2026 at 4:07 am

    The equality operator is ==.
    You are missing an else in the final section of your commented block. You should also be using elseif and not else if. This is not C.

    However, here is one I wrote previously that takes an elapsed interval and returns a string in English. Its roughly what you are aiming at.

    # paste::delta --
    #
    #       Returns the time difference between the given and current time
    #       as an english string.
    #
    proc ::paste::delta {time} {
        set r $time
        catch {
            set delta [expr {[clock seconds] - $time}]
            if {$delta < 60} {
                set r "$delta secs ago"
            } elseif {$delta < 3600} {
                set r "[expr {$delta / 60}] mins ago"
            } elseif {$delta < 86400} {
                set r "[expr {$delta / 3600}] hours ago"
            } else {
                set r "[expr {$delta / 86400}] days ago"
            }
        }
        return $r
    }
    

    So you get things like [paste::delta 7260] giving “2 hours ago” or 310 giving “5 minutes ago”.

    One other thing – with expr statements, always brace the body of the expression with curly braces. Otherwise the parser has to parse the body again and it can have significant performance cost.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.