`time_t` is a Standard-C data type to hold the seconds since UNIX epoch, that since the 1.1.1970.
Questions tagged [time-t]
171 questions
1
vote
1 answer
Does time_t exist in JNA?
I downloaded Java Native Access in Eclipse for use in a program, specifically to use a variable time_t date in order to get a unix timestamp. Does that structure exist, or is it in another form?
In case it doesn't exist, what would be my best…

Alpha1126
- 11
- 1
1
vote
1 answer
time_t declaration issue during compile time
I have a time_t and Struct tm being used in my code. I am not able to initiaize the struct tm like the way i am doing. If this is initialized in the function then it works fine. Please help
#include "time.h"
static struct tm strtime;
struct tm *…

Akshay
- 181
- 1
- 6
- 17
1
vote
2 answers
Equality check for time_t typed variables
I been comparing the equality of the 2 time one that is taken from loacal machine and one from server
time_t local= kernel()->time_now()
this time_now() do return time_t and uses normal way to get sys time
time_t remote =fs->ctime()
getting the…

RaGa__M
- 2,550
- 1
- 23
- 44
1
vote
2 answers
Convert MySQL Datetime to C++ std::time_t
I am stuck in a problem and really hope you can help me. I like to convert a MySQL DATETIME field into a C++ std::time_t variable. My database looks like this:
CREATE TABLE data(
id INTEGER AUTO_INCREMENT UNIQUE,
path …

Michael
- 33
- 1
- 4
1
vote
1 answer
difference of two user entered time c++
i need to be able fill two variables (a kind of time variable), then be able to calculate their difference.
after all of my searches i found difftime, but my problem is that, it uses time_t variables, and i don't know how to fill a 'time_t' with…

Danial Razavi
- 47
- 8
1
vote
1 answer
C: string to milisecs timestamp
I want return in a function a time_t value from timestamp in string format but i don't get it. I need help.
I read a string KEY of a Redis database that it is a timestamp value with form, for example, "1456242904.226683"
My code is:
time_t…

La mujer esponja
- 65
- 5
1
vote
2 answers
64-bit time_t in Linux Kernel
I have compiled kernel 3.19.1 but still have a problem with time_t. Just a simple program with cout << sizeof (time_t); gives size of 4 bytes, not 8 bytes as was my intention.
Should I switch on a particular option during make menuconfig?

user2425502
- 11
- 1
- 3
1
vote
1 answer
Producing UNIX timestamp out of datetime passed in C
I'm porting a C app from Solaris to RedHat, and this function does not work very well on RedHat (and I need your help determing why):
int toTimestamp (const char *InputDate, const char *DateFormat, time_t *lTimestamp){
struct tm tm;
if…

cameroon2
- 13
- 2
1
vote
1 answer
Pack timestamp in 4 bytes
I am very restricted in memory usage.
I need to store a datetime in my program. Precision is one second. Only 4 bytes for one datetime value.
What is the best way to achieve this?

tmporaries
- 1,523
- 8
- 25
- 39
1
vote
2 answers
Convert SQLite Date Field to C++ Time_T
How Do I Convert A SQLite Date in the following format to a C++ Time_T Variable?
YYYY-MM-DD HH:MM:SS

Talon06
- 1,756
- 3
- 27
- 51
1
vote
2 answers
Segmentation fault when using tm struck in C
So I posted my code below (sorry, I know it is long), but I'm getting a segmentation fault when I try to do any operation using the tm struct. I have no idea why I'm getting this seg fault, I'm pretty sure I had it working before, but now I just…

intA
- 2,513
- 12
- 41
- 66
1
vote
4 answers
Writing a function to display current day using time_t?
I've been writing a time converter to take the systems time_t and convert it into human readable date/time. Oh, and this is my second python script ever. We'll leave that fact aside and move on.
The full script is hosted here.
Writing converters for…

Ripdog
- 181
- 2
- 11
1
vote
1 answer
puzzle - printing time in human-readable form in C; ctime, asctime
there is a following puzzle to which I think I know the right answer but I have one issue as well. Have a look:
Sample Code
void printTime( time_t *t )
{
????
}
Which one of the following can replace the ???? in the code above to print the…

Prz3m3k
- 605
- 6
- 14
1
vote
2 answers
c++ time and random function
I'm trying to create a procedural that draws cards from a deck at random. The problem was that I needed to make the draw procedure actually random, as each draw is the same when using srand and rand when no other factors change. Thus I attached it…

David
- 95
- 8
1
vote
3 answers
Converting human time to epoch Unix time returning negative number
I am currently working on some C code and I am trying to convert a human readable date into an epoch time stamp (unix timestamp). However, its always returning a negative number. I'm using struct tm and hard coding the values of the date until I get…

Boardy
- 35,417
- 104
- 256
- 447