SFML community forums

General => Feature requests => Topic started by: StDH on February 02, 2015, 05:41:01 pm

Title: [System] getDateTime
Post by: StDH on February 02, 2015, 05:41:01 pm
i would like to pull request to add function getDateTime inside system module.

examples of use:
 naming screenshots.
 showing time.
 save time to see when did you last played game.

Clock.hpp
static std::string getDateTime(const char* _format = "%d.%m.%Y - %H:%M:%S");
Title: Re: [System] getDateTime
Post by: Hiura on February 02, 2015, 05:55:06 pm
You can achieve exactly the same thing with C++ and no extra dependencies. http://ideone.com/I6M5pa + std::strftime
Title: Re: [System] getDateTime
Post by: StDH on February 02, 2015, 05:56:36 pm
well, i've already done the code, i just wanted to make this simplier.

EDIT: https://github.com/StDH/SFML/compare/LaurentGomila:master...master
Title: Re: [System] getDateTime
Post by: Hiura on February 02, 2015, 05:59:24 pm
It's just my own opinion but this would better fit on the wiki than in SFML.
Title: Re: [System] getDateTime
Post by: Hapax on February 02, 2015, 06:12:31 pm
The clock - in the SFML sense - is more of a stopwatch than an actual clock. I think current time of day etc. should be kept outside of SFML's Clock class.
Title: Re: [System] getDateTime
Post by: Laurent on February 02, 2015, 08:49:07 pm
Why would SFML add an API to wrap a simple standard call?
Title: Re: [System] getDateTime
Post by: StDH on February 03, 2015, 05:47:31 am
Since you can get size of your screen i was thinking about function that returns formatted time.
Title: Re: [System] getDateTime
Post by: Laurent on February 03, 2015, 07:45:53 am
Getting size of screen requires OS-specific calls that cannot be done directly with portable code. Getting current date is directly available in the standard library. That's the difference.