Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
java eclapsed time.
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  Is there a way to turn bullets off..? Post :: Post Dynamic arena?  View next topic  
Author Message
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Sep 19, 2005 7:55 pm    Post subject: java eclapsed time. Reply to topic Reply with quote

I've looked around forever and i can't seem to get this right.

I want !buptime to display how long the bot has been up.

Lets Say:
BDwinsAlt> !buptime
ST 2.3> Bot up for 2 day(s) 11 hour(s) 10 second(s). [Since 09/19/2005 at 7:00]

Please help icon_eek.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Contempt+
Server Help Squatter


Age:36
Gender:Gender:Male
Joined: May 15 2005
Posts: 682
Location: Home
Offline

PostPosted: Mon Sep 19, 2005 8:30 pm    Post subject: Reply to topic Reply with quote

I was gonna start working on that one soon. Just gotta get around to doing it. I've got a lot of other stuff I'm working on at the same time, so I don't have the time to do it, lol.
_________________
SSE Network Administrator
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Mon Sep 19, 2005 10:26 pm    Post subject: Reply to topic Reply with quote

sa_tongue.gif .

I bet it will be harder than you think. I've looked around but nothing gives me a good awnser. icon_eek.gif

Make a really cool bot and webiste then release it for public use.

I'm going to buy a book on java.

Anyone got suggestions?

tell me if http://bots.sscentral.com/bdwinsalt looks ok.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Mon Sep 19, 2005 10:54 pm    Post subject: Reply to topic Reply with quote

That's really loud.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Sep 20, 2005 9:15 am    Post subject: Reply to topic Reply with quote

http://javaalmanac.com/egs/java.util/CompDates.html
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Donkano
Server Help Squatter


Gender:Gender:Male
Joined: Jul 02 2003
Posts: 763
Offline

PostPosted: Tue Sep 20, 2005 6:17 pm    Post subject: Reply to topic Reply with quote

Contempt+ wrote:
I was gonna start working on that one soon. Just gotta get around to doing it. I've got a lot of other stuff I'm working on at the same time, so I don't have the time to do it, lol.


Easy, just get the bot to do: ?usage

Then get it to return that string to the player requesting.
Back to top
View users profile Send private message Add User to Ignore List
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Tue Sep 20, 2005 6:20 pm    Post subject: Reply to topic Reply with quote

That's the most ugly solution, though, Donk.
Back to top
View users profile Send private message Add User to Ignore List
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Tue Sep 20, 2005 6:23 pm    Post subject: Reply to topic Reply with quote

Yea, even Mervbot doesn't do it that way sa_tongue.gif
_________________
Nickname: Maverick (I changed my name!)
TWCore developer | Subspace statistics
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Tue Sep 20, 2005 6:49 pm    Post subject: Reply to topic Reply with quote

it also doesn't solve the problem, donk.

In general, I don't recommend coding if you have trouble spelling words, like the title of your topic. It just leads to syntax errors.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Tue Sep 20, 2005 10:36 pm    Post subject: Reply to topic Reply with quote

Did i ask you how to spell it? sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Contempt+
Server Help Squatter


Age:36
Gender:Gender:Male
Joined: May 15 2005
Posts: 682
Location: Home
Offline

PostPosted: Tue Sep 20, 2005 10:47 pm    Post subject: Reply to topic Reply with quote

It might be hard, but you could get MERV's code for !uptime and see how they do it. Sure Java is different from C++, but you can at least get a basic idea, right?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Wed Sep 21, 2005 12:13 am    Post subject: Reply to topic Reply with quote

it's not a difficult algorithm


record time when the bot is started

when !uptime is called print out the difference in time.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Wed Sep 21, 2005 8:10 am    Post subject: Reply to topic Reply with quote

I just don't know how to record the time when the bot was started. That's where my probelm is. I know how to subtract time into days/hours/minutes now.

I just need that start time.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
Maverick
broken record


Age:40
Gender:Gender:Male
Joined: Feb 26 2005
Posts: 1521
Location: The Netherlands
Offline

PostPosted: Wed Sep 21, 2005 8:53 am    Post subject: Reply to topic Reply with quote

Quote:
public static long currentTimeMillis()
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.
See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Wed Sep 21, 2005 10:27 am    Post subject: Reply to topic Reply with quote

I really wish java would have an option for comparing against the uptime of the system - not a clock. The system clock changes for various reasons, out of sync with UTC, daylight savings time, etc. With that issue imports an instability into the timer scheduler of Java - which I have already discussed. Had they used the uptime of the OS, it'll never go backwards, nor massively forward into the future. A bit more stable. :/
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
BDwinsAlt
Agurus's Posse


Age:34
Gender:Gender:Male
Joined: Jun 16 2003
Posts: 1145
Location: Alabama
Offline

PostPosted: Wed Sep 21, 2005 9:01 pm    Post subject: Reply to topic Reply with quote

Agreed. And i'll try and see if it lets me send the currentMillis ina private message. Last time it said it couldn't do somethign with int.

I dunno, ill figure it out.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address Yahoo Messenger MSN Messenger
D1st0rt
Miss Directed Wannabe


Age:37
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Thu Sep 22, 2005 3:05 am    Post subject: Reply to topic Reply with quote

Cyph, you mean like System.currentTimeMillis()?
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Sep 22, 2005 8:18 am    Post subject: Reply to topic Reply with quote

System.currentTimeMillis() depends on the current system time, not the uptime of the OS. They also say a lot of 'beware' statements in the API about it.

Looking though,nanoTime() looks more or less what I think, I would use. the API states "Returns the current value of the most precise available system timer, in nanoseconds." - not sure. It has the guarantee of precision but not accuracy. :/

:shrug:
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Sep 22, 2005 10:13 am    Post subject: Reply to topic Reply with quote

From what I've gathered, he's not concerned about OS uptime. Only finding bot uptime.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Sep 22, 2005 10:22 am    Post subject: Reply to topic Reply with quote

I know that. But, the "elapsed" (current_time - old_time) time will change when daylight savings time, etc. occur, does it not?

That's why you need an independent timing system such as the uptime of the OS where it'll never go backwards/forwards based on any specific day (or time).

I feel this appropriate quote fits well:

"Time line?!?!? This is no time to argue about time! We don't HAVE the time! ... what was I saying?" -- Troi, Star Trek: First Contact. icon_smile.gif icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Thu Sep 22, 2005 10:35 am    Post subject: Reply to topic Reply with quote

I don't think an hour inaccuracy twice a year is anything to worry about for this application
_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Thu Sep 22, 2005 12:30 pm    Post subject: Reply to topic Reply with quote

technically 'yes', you "should" worry about it.
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Thu Sep 22, 2005 12:57 pm    Post subject: Reply to topic Reply with quote

why? He wants a way to see if his bot is staying online for a long time.

It's not a life or death application, any effort to avoid things like daylight savings time is not worth the time spent implementing.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:39
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Sep 22, 2005 1:48 pm    Post subject: Reply to topic Reply with quote

I would think with a definition like "the number of milliseconds elapsed since 12:00, midnight, Jan 1 1970", that DST would already be factored in. I could be wrong, of course.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Sep 22, 2005 4:09 pm    Post subject: Reply to topic Reply with quote

Seeing as a long will overflow in 49.7 days, I'd say using a GetTickCount-like function would be more reliable than this currentTimeMillis().
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 1248 page(s) served in previous 5 minutes.

phpBB Created this page in 6.985324 seconds : 49 queries executed (98.9%): GZIP compression disabled