Questions tagged [time-t]

`time_t` is a Standard-C data type to hold the seconds since UNIX epoch, that since the 1.1.1970.

171 questions
0
votes
3 answers

c Specific Date to Time

I want to convert from specific date to seconds in C. For example, If I give 12/25/2015, it will convert into seconds. This is the program I found to convert current date to seconds. But I want to convert from specific date to seconds. time_t…
Smith Dwayne
  • 2,675
  • 8
  • 46
  • 75
0
votes
1 answer

Is it safe to convert DateTime in time_t whithout error handling in C++ CLI?

I would like to use next code: long long DateTimeToTimeT(System::DateTime dt) { System::DateTime epoch(1970, 1, 1, 0, 0, 0, 0); long long totalSeconds = (dt - epoch).TotalSeconds; return totalSeconds >= 0 ? totalSeconds : 0; } So…
user2706838
  • 1,061
  • 2
  • 13
  • 21
0
votes
5 answers

How can I name the text file I create after the current date/time

First of all, my knowledge of X++ is minimal, I just need to edit the code I've been given. I have a C++ program which creates a text file and stores data in it. Right now the program is…
user3131101
  • 19
  • 3
  • 5
0
votes
1 answer

gsoap complexTtype containing a complexType

For a project, i have to write a gsoap client on a Windows platform. I'm using MinGw g++. I have generated the code using the -j option in order to receive the soap...Proxy.h and .cpp files I want to send a request to our web service, where the…
surreal
  • 33
  • 5
0
votes
1 answer

strtoul to convert from String date ("03/10/2013 14:01:00") to time_t

I don't understand, why this doesn't work? PS: I found this piece of code from some google! Problem: I don't know why it should work? Does this consider timezone as well?! 1 #include 2 #include 3 #include 4…
code muncher
  • 1,592
  • 2
  • 27
  • 46
0
votes
1 answer

Set time_t to unsigned 32-bit int

I'm doing some embedded software and its time_t is unsigned 32-bit integer. I have a PC simulator whose time_t appears to be signed 32-bit integer. Is there any way to tell Visual C to use uint32_t?
leon
  • 435
  • 1
  • 4
  • 12
0
votes
2 answers

How to get current time with milliseconds using "time.h" library (only)?

I need to get the milliseconds as well using only the "time.h" library. For seconds, this is what I have: time_t now; time(&now); printf("seconds since Jan 1, 1970 %d", now);
jdl
  • 6,151
  • 19
  • 83
  • 132
0
votes
1 answer

C++ timestamp and diffTime

I'm trying to know the timestamp when I receive a message. I should check if it has been N seconds of receiving the last message. I'm using time_t. I take the current time like this: time (& myTime); how can I check if they spent more than N…
Safari
  • 11,437
  • 24
  • 91
  • 191
0
votes
1 answer

convert wxString to time_t

I have a wxString which has a date as its value. The date format is stored depending on the regional setting or locale settings. For eg. wxString dateStr = "9/10/2013" [dd/mm/yyyy format for Italy as regional locale setting]. When I parse the date…
Gunjan49
  • 53
  • 1
  • 5
0
votes
3 answers

javascript date time_ t conversion

I'm having a problem with the date format in javascript. I'm getting a date in seconds (in time_t format) from a database (ex. 1364565600) Now I want to convert this date to day, month, day (ex. Tuesday, March, 18th). I hope this is possible. …
Bjorn Ravers
  • 1
  • 2
  • 3
0
votes
2 answers

What C++ function should return?

I have the following snippet of code: time_t data1 = time(0)+86400; struct tm * data_emprestimo = localtime( & data1 ); cout << "Hoje: " << data_emprestimo->tm_mday << '/' << (data_emprestimo->tm_mon + 1) << '/' << (data_emprestimo->tm_year +…
0
votes
5 answers

Converting days since epoch to seconds since epoch

At my new workplace, they represent a lot of dates as "days since epoch" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the…
Andrew Hedges
  • 21,688
  • 16
  • 67
  • 79
0
votes
1 answer

Why can't I set a time_t larger than 2^32?

I'm messing around with FUSE in C and I wanted to create a file that would appear to be created very far into the future. The custom stat() function I'm writing in FUSE writes to a struct stat* stbuf and I want to do something like stbuf->st_ctime =…
Tneuktippa
  • 1,645
  • 3
  • 15
  • 25
0
votes
2 answers

How to convert 32 bit time_t value to 64 bit time_t

I am working on an embedded system. Our platform is 32-bit so time_t size is 32-bit. For now I want to send a struct to a Windows 7 computer as a char array. One of fields of my struct is time_t. I can't change struct. So I must send time value to…
Murat
  • 803
  • 4
  • 15
  • 27
0
votes
1 answer

Formatting mtime from stat(system call)

So I'm writing a program to mimic the "find" command in linux. I have everything taken care of, but I cannot figure out how to format the string from ctime, mtime and atime. I know the arguments are struct time_t, but I can't find to convert it to a…
twsmale
  • 139
  • 1
  • 5
  • 14
1 2 3
11
12