Get Time
#13

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
So you think repeatedly modifying code until it fixes all bugs and corner-cases is better than just using existing code that works?
What kind of bugs are in there? Could you please state a specific example, apart from what has already been stated and can easily be fixed since the solution is already present?


Quote:
Originally Posted by Y_Less
Посмотреть сообщение
That’s not a good solution. If you have to have additional code before calling a function to ensure that the function works correctly, the function is no longer self-contained. This is called a “leaky abstraction”, and is where your code is directly tied to the internals of a function. If you call the function five times, you have to ensure all the other code is right five times. If there’s a bug you have to fix it five times, and hope you didn’t forget a sixth.
Obviously this would be done in a separate function, which is then calling the TimestampToDate.
For example:
Код:
stock TimestampToDateForPlayer(playerid, Timestamp, &year, &month, &day, &hour, &minute, &second)
{
	return TimestampToDate(Timestamp + tOffset[playerid][0]*3600 + tOffset[playerid][1]*60 + tOffset[playerid][2], year, month, day, hour, minute, second, 0);
}
No need to fix anything in multiple instances.
Additionally, this has nothing to do with leaky abstraction, it's simply making use of a personalizable function.
Furthermore, you'd need this in combination with the Chrono Plugin too.


Quote:
Originally Posted by Y_Less
Посмотреть сообщение
What’s that got to do with the video? Just because you’ve never hit the bugs that are provably there doesn’t mean they don’t exist and won’t be hit by other people.
As stated in the first paragraph, could you please provide a practical example, where the function runs into a bug, excluding the issues already stated where the solution is already present?
If not, I do not see a reason why calling this function bugged.


Quote:
Originally Posted by Y_Less
Посмотреть сообщение
All plugins are required to release their source. They are no more a black-box than includes, and faster. You might not like plugins, and that’s up to you, but don’t inflict your ignorance on others but preventing them being suggested better code.
That's true, but nevertheless, modifying a plugin is way more complex than modifying a PAWN code, that's why I said "pretty much". You can have a look into the code, but modifying it for your needs is nothing everybody can or will do.

Actually, I do not even see the point of a discussion here. If I haven't had issues over half a decade with the function, I'm right to say the function works well for most requirements and most likely it fulfills Longover's requirements too. If not, he can use the plugin. It has nothing to do with ignorance, it's a simple suggestion based on my opinion and my experiences.
Reply


Messages In This Thread
Get Time - by Longover - 02.03.2019, 08:03
Re: Get Time - by Longover - 02.03.2019, 08:14
Re: Get Time - by Longover - 02.03.2019, 08:43
Re: Get Time - by Jeffry - 02.03.2019, 09:02
Re: Get Time - by Longover - 02.03.2019, 09:38
Re: Get Time - by Jeffry - 02.03.2019, 10:14
Re: Get Time - by Longover - 02.03.2019, 10:26
Re: Get Time - by Jeffry - 02.03.2019, 10:38
Re: Get Time - by Longover - 02.03.2019, 10:47
Re: Get Time - by Jeffry - 02.03.2019, 14:29
Re: Get Time - by Jeffry - 02.03.2019, 19:57
Re: Get Time - by Jeffry - 03.03.2019, 11:50
Re: Get Time - by Jeffry - 03.03.2019, 18:15
Re: Get Time - by masuzaron - 03.03.2019, 19:11

Forum Jump:


Users browsing this thread: 1 Guest(s)