view include/core/session.h @ 301:b1f625b0227c

*: convert all files CRLF -> LF some files were in DOS format, others were in unix. now everything (that at least is under our control) should all be the same format
author Paper <paper@paper.us.eu.org>
date Mon, 13 May 2024 15:04:51 -0400
parents ac1451035c85
children 34347fd2a2de
line wrap: on
line source

#ifndef MINORI_CORE_SESSION_H_
#define MINORI_CORE_SESSION_H_

#include "core/config.h"
#include "gui/locale.h"

#include <QElapsedTimer>

#include "semver/semver.hpp"

#include <atomic>

struct Session {
public:
	Session() { timer.start(); }
	/* we literally *cannot* be lying to the user by doing this */
	void IncrementRequests() { requests++; };
	unsigned int GetRequests() { return requests; };
	int uptime() { return timer.elapsed(); }

	Config config;
	static constexpr semver::version version{PACKAGE_VERSION};

private:
	/* IncrementRequests() gets called by different threads */
	std::atomic<unsigned int> requests = 0;
	QElapsedTimer timer;
};

extern Session session;

#endif // MINORI_CORE_SESSION_H_