174 questions
1
vote
1
answer
158
views
Recording Time in C++ with Chrono [duplicate]
I want my program to record the time that a particular process is running. I have a timeFunction() that should get called whenever I want to record the time. When called, it should return the time in ...
3
votes
3
answers
270
views
C++ chrono: store and retrieve date and time in 64 bit format for 2038 rollover
2038 is coming...I have to think date time in 64 bit! I'm trying to understand how to do this in C++, with chrono library, but I'm failing miserably so far.
I will have to communicate a date time ...
0
votes
2
answers
479
views
Display Number of Days in the current Month
I have an assignment for my C++ class that is mostly complete. However, I am unsure as to how I am supposed to make the program display the days of the current month. I'm able to make it work with ...
0
votes
1
answer
86
views
In C language I got a error in <time.h> library about time_t
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
struct aracbilgiturleri {
char Plaka[50]; //licanse plate
char ...
1
vote
2
answers
140
views
search for uses of int used instead of time_t
I have a rather large c-code base, where every once in a while int is used instead of time_t. Any good ideas as to how to deal with this. Should I search the entire standard library for functions that ...
0
votes
1
answer
209
views
C++ Question: From string to time_t object?
I have a program I'm writing to take inputs from the command line or a file with the format:
9999.365 --> Fri 31 Dec 9999
Where the output needs to look like the second part of that example. I'm ...
2
votes
1
answer
58
views
Incorrect result after adding days to date
Using below function, which simply adds days to date (yyyymmdd), works fine throughout years.
int dateplusdays(int datein, int days) {
int year, month, day;
int dateout;
struct tm date;
...
3
votes
2
answers
2k
views
Converting seconds since epoch to time_t
I have a string representing seconds since epoch, and I need to convert it to a human readable string. I've seen a few posts online that suggest simply casting an integer to time_t as so:
time_t time ...
0
votes
1
answer
56
views
Using time_t filttering
I'd like to understand better time_t since i've never dealt with it before.
I want to make a filter_by_time function that gets a time window (lets say, 24 hours) and sends me back a vector of objects ...
0
votes
0
answers
285
views
C++ Get UTC date time of file creationdate
Hey I'm having trouble coding the following:
I want to get the creationdate of a file by processid and I did it like so:
TCHAR Buffer[MAX_PATH];
if (GetModuleFileNameEx(Handle, 0, Buffer, MAX_PATH))
{
...
1
vote
2
answers
607
views
How to tell if it's before a configured time in C++?
I'm trying to find the best way to see if the current time is before a specified time. Say I want to see if it's before 14:32. What's the best way to do this in C++? Ideally I'd be able to build some ...
0
votes
0
answers
75
views
Trying to retreive time_t equals to 1 sec. from tm equals Thu Jan 01 00:00:00 1970
Why is forward conversion from time_t, equaled to 1, to tm valid, whereas backward is not?
#include <ctime>
#include <map>
using namespace std;
int main() {
time_t timer = 1;
tm *...
1
vote
2
answers
888
views
How to find Time Duration between two dates with Hours minutes and seconds in C++ 11?
I need to find the time difference between two given dates.
I have tried the following code but not able to convert it into hours mins secs
const char *time_details = "06/10/2021 16:35:...
1
vote
0
answers
2k
views
glibc set __TIMESIZE
I'm trying to port my 32-bit ARM architecture to 64-bit time values.
Reading the answers from 64-bit time_t in Linux Kernel it tells me the following:
All user space must be compiled with a 64-bit ...
0
votes
1
answer
787
views
Calculate time difference using c++
I have a chunk of code where I am trying to convert the string time into time_t and then use the difftime() method to do a comparison. However, currently, the difftime returns 0 instead of the number ...