Hello everyone,
In MSDN for time function,
time_t time(
time_t *timer
); http://msdn2.microsoft.com/en-us/lib...33(VS.80).aspx
the return value of time is time_t, but in the Return Value section, it
mentioned,
Return the time as seconds elapsed since midnight, January 1, 1970. There is
no error return.
So, I am wondering whether time_t could be represented as elapsed number of
seconds correctly and safely -- no data lost if we convert return value to
unsigned long?
Like,
unsigned long second = time (NULL);
thanks in advance,
George 1 1235
>In MSDN for time function,
> time_t time(
time_t *timer );
http://msdn2.microsoft.com/en-us/lib...33(VS.80).aspx
the return value of time is time_t, but in the Return Value section, it mentioned,
Return the time as seconds elapsed since midnight, January 1, 1970. There is no error return.
So, I am wondering whether time_t could be represented as elapsed number of seconds correctly and safely -- no data lost if we convert return value to unsigned long?
George,
time_t is (in later compilers) defined as a 64-bit value (with the
option of being a 32-bit value for backward compatibility). It's best
if you play by the rules and use it with appropriate functions such as
difftime.
Dave This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Wei Jones |
last post by:
Hi, all
I got a problem as subject title. I create a pthread which like :
static time_t *Now;
void get_time(void *tmp)
{
while(1) {
time(&Now);
disp_time_somewhere();
sleep(1);
|
by: KW |
last post by:
Hi all,
Appreciate if someone can help me out on this.
Currently, I have a tm structure holding information of the UTC time,
which is very likely to be in the past, meaning not the current...
|
by: David Buchan |
last post by:
Hi guys,
This may be a dumb question; I'm just getting into C language here.
I wrote a program to unpack a binary file and write out the contents to
a new file as a list of unsigned integers....
|
by: __jakal__ |
last post by:
Hello,
I need to find out the time difference between UTC and local time.
I am doing it the following way
#include <sys/timeb.h>
#include <stdio.h>
int main()
{
struct timeb tp;
ftime(&tp);
|
by: Yuanfei |
last post by:
Hi There,
I just found that there is a problem in vc2005 regarding to time_t and
localtime. See code snippets belows. Using this code segment, I found that
when ut is 86200, the corresponding...
|
by: moni |
last post by:
I have 2 time values:
System time and an input from the user.
1) System time is in the form of seconds from 1/1/1970 calculated by
using
|
by: ZR |
last post by:
Hello,
I need to convert a GMT time string to local time. I can fill out a "tm"
structure with the GMT time string. Are there any standard C (or OS) time
functions that will allow me to do this?
...
|
by: Grey Alien |
last post by:
I need to convert timestamps that are given as the number of seconds
that have elapsed since midnight UTC of January 1, 1970, (not counting
leap seconds).
It seems all of the std C functions...
|
by: Nickolai Leschov |
last post by:
Hello,
I'm reading code for time function in glibc and I see the following
fragment in file time\time.h:
/* Return the time now, and store it in *TIMER if not NULL. */
time_t
time (timer)...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |