mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
4a165980e7
Before, a non-owning pointer was passed and the dive moved away from the dive. Instead, let the caller decide if they still want to keep a copy of the dive, or give up ownership: In MainWindow and QMLManager new dives are generated, so one might just as well give up ownership. In contrast, the planner works on a copy (originally the infamous "displayed_dive") and now moves the data manually. This commit also removes duplicate code, by moving the "create default dive" code from MainWindow and QMLManager to struct dive. Finally, determination of the "time zone offset" is not done in POSIX, since we want to avoid calls form the core into Qt. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
21 lines
635 B
C++
21 lines
635 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef TIME_H
|
|
#define TIME_H
|
|
|
|
#include "units.h"
|
|
#include <string>
|
|
#include <time.h>
|
|
|
|
extern timestamp_t utc_mktime(const struct tm *tm);
|
|
extern void utc_mkdate(timestamp_t, struct tm *tm);
|
|
extern int utc_year(timestamp_t timestamp);
|
|
extern int utc_weekday(timestamp_t timestamp);
|
|
extern int gettimezoneoffset();
|
|
|
|
/* parse and format date times of the form YYYY-MM-DD hh:mm:ss */
|
|
extern timestamp_t parse_datetime(const char *s); /* returns 0 on error */
|
|
extern const char *monthname(int mon);
|
|
|
|
std::string format_datetime(timestamp_t timestamp); /* ownership of string passed to caller */
|
|
|
|
#endif
|