generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What exactly is os.clock, os.date and os.time?

Previous Thread :: Next Thread 
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
11 Jun 2013 10:53 AM
title
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
11 Jun 2013 10:56 AM
I only know it from ComputerCraft.

Though... search for "ComputerCraft wiki os API" on Google, then you might learn about it.

- As, meep. Instance.new("UtilityObject", workspace).Name = "As8D" RAIN!
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
11 Jun 2013 10:57 AM
>Knows it
>Tells me to go to wiki
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
11 Jun 2013 11:02 AM
Okay, citated from the CC wiki os API page's os.clock and os.time links:

- os.clock
"Returns float, amount of time the computercraft computer has been running, in seconds. "
This makes me think that it's simply identical to ElapsedTime(), as it will return how long time something (Roblox or a CC computer or whatever) has been running for.

- os.time
"Returns float The current in-game time."
Seems like this one is tick(), as it will return the amount of seconds since UNIX (or... hm... I have to rethink this)


- As, not on the API list. Sorry.
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
11 Jun 2013 11:03 AM
os.clock()

Return CPU time since Lua started in seconds.

> = os.clock()
11056.989


os.date([format [, time]])

Return formatted date string, or table of time information. The format string has the same format as the C strftime() function.

TODO: insert info, examples and links to strftime()
List all params at http://www.cplusplus.com/reference/clibrary/ctime/strftime/

Simple example:

> = os.date("%d.%m.%Y")
06.10.2012
If the format string is "*t" a table is returned containing the time information, e.g,

> table.foreach(os.date('*t'), print)
hour 14
min 36
wday 1
year 2003
yday 124
month 5
sec 33
day 4
isdst true
Above example using pairs() method:

> for k, v in pairs(os.date("*t")) do print(k, v) end
year 2012
day 1
min 54
wday 4
month 8
isdst true
yday 214
sec 39
hour 14
If the format is preceeded by "!" the time is converted to Coordinated Universal Time, e.g.,

> table.foreach(os.date('!*t'), print)
hour 21
min 36
wday 1
year 2003
yday 124
month 5
sec 42
day 4
isdst false
Above example using pairs() method:

> for k, v in pairs(os.date("!*t")) do print(k, v) end
year 2012
day 1
min 58
wday 4
month 8
isdst false
yday 214
sec 39
hour 12
os.date() returns a string in the format MM/DD/YY HH:MM:SS.

> print(os.date())
08/16/05 10:22:32
Nowadays os.date() returns a string in different format:

> = os.date()
Wed Aug 1 15:00:47 2012
Report Abuse
KimJongUnKorea is not online. KimJongUnKorea
Joined: 10 Jun 2013
Total Posts: 19
11 Jun 2013 12:06 PM
Your ass
Report Abuse
777MrEpic is not online. 777MrEpic
Joined: 17 Oct 2012
Total Posts: 3998
11 Jun 2013 12:10 PM
@KimJong
Thanks man, now I can make epic scripts!
Report Abuse
BrandonFireflower is not online. BrandonFireflower
Joined: 09 Feb 2010
Total Posts: 731
11 Jun 2013 12:12 PM
Ever heard of the magical thing called PiL?
Programming in Lua?

That online manual about Lua?
That tells you everything you need to know?
And more?
Report Abuse
adoman is not online. adoman
Joined: 01 Sep 2010
Total Posts: 306
25 Oct 2015 07:36 PM
THIS IS ALL WRONG. IT IS STOLEN FROM:

http://lua-users.org/wiki/OsLibraryTutorial

THAT WEBSITE AND NONE OF IT WORKS

DON'T BOTHER USING IT!
Report Abuse
bubblas is not online. bubblas
Joined: 15 Aug 2010
Total Posts: 9
10 Jul 2016 10:42 PM
I know this is an old post but, for everyone in the future reading this, here is the os.time wiki article:
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#os.time
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
10 Jul 2016 10:43 PM
os date and clock cant be used on roblox.


- Isosta
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
10 Jul 2016 10:45 PM
At least someone bumped with something useful. That doesn't often happen. Ask AbstractMadness, who recently bumped a couple of threads for his enjoyment.

The only problem is, there is enough data on this topic to help anyone who searches for it. The only reason new threads crop up on stuff like this is they either don't search it, don't understand the wiki, or can't think of how to word it.


Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
10 Jul 2016 11:58 PM
RIP 2 amazing people (As8D and LuaWeaver) from this forum :(
Report Abuse
kylerzong is not online. kylerzong
Joined: 06 Aug 2011
Total Posts: 659
21 Sep 2017 09:21 PM
Noot Noot
Report Abuse
Sluethen is not online. Sluethen
Joined: 16 Nov 2015
Total Posts: 6
18 Nov 2017 04:48 PM
This helped me alot! Thanks m8. And yes it does work I just tested it ;3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image