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 conversion:
function daysToTimestamp(days) {
return Math.round(+days * 86400);
}
By way of exam...
I have some code that uses the Oracle function add_months to increment a Date by X number of months.
I now need to re-implement the same logic in a C / C++ function. For reasons I don't want/need to go into I can't simply issue a query to oracle to get the new date.
Does anyone know of a simple and reliable way of adding X number of m...
The official Python 2.5 on Windows was build with Visual Studio.Net 2003, which uses 32 bit time_t. So when the year is > 2038, it just gives exceptions.
Although this is fixed in Python 2.6 (which changed time_t to 64 bit with VS2008), I'd like to use 2.5 because many modules are already compiled for it.
So here's my question - is the...
Hi there,
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 the year and month were fairly easy, but I've hit a serious brick wall tryin...
I need to get the current time in a "HH:MM:SS"-format into a character array (string) so I can output the result later simply with a printf("%s", timeString);
I'm pretty confused on the timeval and time_t types btw, so any explanation would be awesome:)
EDIT:
So I tried with strftime etc, and it kinda worked. Here is my code:
time_t c...
Hi!
I'm rewriting an old program to do some new stuff, and suddenly I get a segmentation fault error on the following line of code:
time_t seconds_since_time_begun = time(0);
Why, oh why?
Update:
I have included the time.h header file in my code, and when I tried what pmg suggested below, both variables were 4 in size.
When I tried...
I'm writing a multi-threaded program that needs to be able to check if a row requires updating and act accordingly.
I had problems using the built in date/time functions of MySql and so decided to just store the "lastupdate" timestamp as an integer in the table. However, I'm having problems converting this timestamp to time_t so that I...
Hi guys, I'm using a time_t variable in C (openMP enviroment) to keep cpu execution time...I define a float value sum_tot_time to sum time for all cpu's...I mean sum_tot_time is the sum of cpu's time_t values. The problem is that printing the value sum_tot_time it appear as an integer or long, by the way without its decimal part!
I tried...
on Visual studio I can force use of 32 bit time_t by declaring _USE_32BIT_TIME_T is there a similar equivalent for gcc? or is it always 32 bit or is it always 64 bit?
...
I do not know the data type of time_t. Is it a float double or something else? Because if I want to display it I need the tag that corresponds with it for printf. I can handle the rest from there for displaying time_t but I need to know the data type that corresponds with it.
...
Is there any method provided by Apple or any technique that can convert a time_t type variable to an NSDate object?
...
Here is my current situation:
I have two tm structs, both set to the current time
I make a change to the hour in one of the structs
The change is occurring in the other struct magically....
How do I prevent this from occurring? I need to be able to compare and know the number of seconds between two different times -- the current time a...
Hello, is there any way to convert a time_t to a string with the format YYYY-MM-DD HH:MM:SS automatically, keeping the code portable?
...
My code receives a time_t from an external source. However, that time_t isn't acutally based on UTC Epoch time, along with it I get a timezone string (eg, EDT, PST, etc), and its based on this offset'ed epoch. I need to convert this to a true UTC Epoch based time_t.
Additionally, I need to be able to go in the opposite direction, taking...
Hello.
I currently have code that creates a CTime object from a defined value.
#define TIME_VALUE 0x301DDF00 // Aug 1, 1995 @ 04:00:00
CTime t = CTime( TIME_VALUE );
This creates the desired date of Aug 1, 1995 04:00:00
I can no longer use CTime so I am trying to use time_t and tm instead. Since the CTime constructor takes in the ...