![]() |
getTimeStamp()
I think it would be nice if there were some way to get a timestamp. Instead of calculating it all out with timevar2, it would be handy to return the same timestamp as it would appear on logs. This would enable scripters to create logs in different directories as well as numerous other uses.
Maybe I'm wrong and there's already a function like this? |
You could script some kind of class for getting a timestamp. However, I agree that it would be handy to have a function like this built-in. Maybe even something similar to PHP's date() function.
|
I use HR's time system for this, works like a charm. :)
|
If somebody were to script this, couldn't Skyld just add it in with the shared functions pack? shared.date(PHP date() format), would be optimal, but something like shared.timestamp() with a single format (MM/DD/YYYY HH:MM:SS or something) would work just fine.
|
Quote:
|
Quote:
|
Quote:
EDIT: Could you explain the reason why a shared functions pack can't be serverside? |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
For it to be able to transport serverside code in the same way, the server and client would need to be modified to accept serverside code from the client, and that would be awfully insecure, but I don't know whether some way of automatically copying the shared functions script from the login server to other servers periodically would work. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
Quote:
PHP Code:
PHP Code:
|
Quote:
PHP Code:
PHP Code:
|
Quote:
Date functions like that are rather language independent and if a proper explanation is provided it could easily be figured out by someone knew to scripting, provided they understand the basics. Obviously there would also be one or two default timestamp formats also. |
You guys don't understand what I'm saying at all. I know that it can be done with HR's script. What I'm telling you is that HR's script isn't beginner-friendly. Look at how many functions you have to do just to get a single format: 12. How many lines of code would you need to recreate the amount of combinations PHP's date() function has? It'd be much simpler to just provide a single function that can support myriad formats.
I guess I have a new side-project. |
Dylan, or whatever you name is, your code is unnecessary and not very flexible. You might want to get some more programming experience before saying how inefficient a code is.
The modifications I made to HR's system provide easy timestamp access for all client- and serverside scripts. I simply have the script setting all local variables as serverr strings, then have a getTimeStamp() function in a class (identical ones both on client- and serverside, script replication is evil :( ) that any script can use by simply reading the time from the serverr variables. |
Quote:
|
Quote:
And yes, Ziro, his name is Dylan. |
Quote:
|
Why don't you use HR's functions to mimic date()? It's not like PHP's date() is some fancy 2 line code which magically returns whatever you want, goddamnit.
|
Thing is, I think this should have been something done way before HellRavens function pack for it was made. It's pretty common and important for keeping track of the time for various things.
I'm not saying this should be done, but I don't know why it wasn't done before. It seems like it would have had many practical uses. |
When I try using HR's functions on the clientside with the proper timevar2 from the server it doesn't work correctly, I think it has something to do with how the calculation is being done.
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 01:13 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.