A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/alandefreitas/matplotplusplus/commit/536fe984d9bc7face3bc630ead8bc7d1d0da9c48 below:

Fix localtime · alandefreitas/matplotplusplus@536fe98 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+12

-0

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+12

-0

lines changed Original file line number Diff line number Diff line change

@@ -3,7 +3,13 @@

3 3

//

4 4 5 5

#include <cmath>

6 +

#if defined(__unix__)

7 +

#include <time.h>

8 +

#elif defined(_WIN32)

9 +

#include <time.h>

10 +

#else

6 11

#include <ctime>

12 +

#endif

7 13

#include <matplot/core/axes_type.h>

8 14

#include <matplot/core/axis_type.h>

9 15

#include <matplot/core/figure_type.h>

@@ -257,7 +263,13 @@ namespace matplot {

257 263

char buff[20] = {0};

258 264

time_t now = (time_t)tick_values_[i];

259 265

struct tm buf;

266 +

#if defined(__unix__)

267 +

localtime_r(&now, &buf);

268 +

#elif defined(_WIN32)

260 269

localtime_s(&buf, &now);

270 +

#else

271 +

buf = *std::localtime(&now);

272 +

#endif

261 273

strftime(buff, 20, tick_label_format_.c_str(), &buf);

262 274

r += "\"" + escape(std::string(buff)) + "\" ";

263 275

} else {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4