Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [System] getDateTime  (Read 3771 times)

0 Members and 1 Guest are viewing this topic.

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
[System] getDateTime
« 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");
« Last Edit: February 02, 2015, 05:54:01 pm by StDH »
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [System] getDateTime
« Reply #1 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
SFML / OS X developer

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
Re: [System] getDateTime
« Reply #2 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
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: [System] getDateTime
« Reply #3 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.
SFML / OS X developer

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: [System] getDateTime
« Reply #4 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [System] getDateTime
« Reply #5 on: February 02, 2015, 08:49:07 pm »
Why would SFML add an API to wrap a simple standard call?
Laurent Gomila - SFML developer

StDH

  • Jr. Member
  • **
  • Posts: 56
  • {⛺.⛺}
    • View Profile
    • Worst ever ^^
Re: [System] getDateTime
« Reply #6 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.
<StDH> Imagine a girl writing you this: My farts smell good
<Slipxy> married.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [System] getDateTime
« Reply #7 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.
Laurent Gomila - SFML developer

 

anything