Sponsored Content
Top Forums Programming enable 64bit long type for gcc Post 302270094 by jim mcnamara on Friday 19th of December 2008 03:58:55 PM
Old 12-19-2008
I ran this in a 32 bit executable under ubuntu:

Code:
#include <sys/types.h>
#include <stdio.h>

void foo(time_t t)
{
	printf("%u\n", t); 
	printf("%d\n", t);
}

int main()
{
	time_t tim=1230768000;
	foo(tim);
	return 0;
}

This is what I got:
Code:
/home/jmcnama> a.out
1230768000
1230768000

You have a coding problem not a datatype problem. Can you post the shortest possible chunk of code that shows your problem?
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

32bit vs 64bit

Whats the difference between 32bit and 64bit OS's or applications. I understand it a little but its just not clicking the way the teacher explained to me thanks, any info would be much appreciated (1 Reply)
Discussion started by: eloquent99
1 Replies

2. Shell Programming and Scripting

String type to date type

Can one string type variable changed into the date type variable. (1 Reply)
Discussion started by: rinku
1 Replies

3. Programming

array type has incomplete element type

Dear colleagues, One of my friend have a problem with c code. While compiling a c program it displays a message like "array type has incomplete element type". Any body can provide a solution for it. Jaganadh.G (1 Reply)
Discussion started by: jaganadh
1 Replies

4. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders à /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) à pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

5. Programming

gcc 4.3.2 accept sys call warrning incompatible pointer type

Hi all, this warning is driving me nuts. I use -pedantic with -Wall and -Werror so this needs to be fixed. BUILD: GNU-Linux-x86 Any ideas? struct sockaddr_in server_addr; int addr_len = sizeof (server_addr); fd = accept(link->socket_fd, (struct sockaddr_in *)... (2 Replies)
Discussion started by: personificator
2 Replies

6. Programming

Problem FETCHing Long data type using CURSOR

Currently my Pro*c program is fetching a cloumn which is defined as LONG in oracle db. The data in the column is around 65k. But when I am FETCHing it to a varchar variable, I am only getting 22751 bytes of data using cursor. Is there any limitation on the data which is fetched by a cursor in... (2 Replies)
Discussion started by: manbt
2 Replies

7. Red Hat

How to enable AIO and DIO on rhel5 64bit?

Hi Friends, Please help me to understand, how to enable async disk IO and Direct disk IO in ext3 filesystem on rhel5. Regards, Arumon (0 Replies)
Discussion started by: arumon
0 Replies

8. Shell Programming and Scripting

Extracting LONG Data Type from DB via UNIX Script

Hi, I want to extract a XML file which is stored in the database having a data Type as "LONG" via UNIX Scripting. But when i am triggering the SQL via UNIX it is fetching only the first Line and not the complete XML. Can you please suggest if the parameters that i have used needs any... (0 Replies)
Discussion started by: dear_abhi2007
0 Replies

9. Shell Programming and Scripting

Extracting LONG Data Type from DB via UNIX Script

Hi, I want to extract a XML file which is stored in the database having a data Type as "LONG" via UNIX Scripting. But when i am triggering the SQL via UNIX it is fetching only the first Line and not the complete XML. Can you please suggest if the parameters that i have used needs any... (2 Replies)
Discussion started by: Barbara1234
2 Replies
TIME(3P)						     POSIX Programmer's Manual							  TIME(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
time - get time SYNOPSIS
#include <time.h> time_t time(time_t *tloc); DESCRIPTION
The time() function shall return the value of time in seconds since the Epoch. The tloc argument points to an area where the return value is also stored. If tloc is a null pointer, no value is stored. RETURN VALUE
Upon successful completion, time() shall return the value of time. Otherwise, (time_t)-1 shall be returned. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
Getting the Current Time The following example uses the time() function to calculate the time elapsed, in seconds, since the Epoch, localtime() to convert that value to a broken-down time, and asctime() to convert the broken-down time values into a printable string. #include <stdio.h> #include <time.h> int main(void) { time_t result; result = time(NULL); printf("%s%ju secs since the Epoch ", asctime(localtime(&result)), (uintmax_t)result); return(0); } This example writes the current time to stdout in a form like this: Wed Jun 26 10:32:15 1996 835810335 secs since the Epoch Timing an Event The following example gets the current time, prints it out in the user's format, and prints the number of minutes to an event being timed. #include <time.h> #include <stdio.h> ... time_t now; int minutes_to_event; ... time(&now); minutes_to_event = ...; printf("The time is "); puts(asctime(localtime(&now))); printf("There are %d minutes to the event. ", minutes_to_event); ... APPLICATION USAGE
None. RATIONALE
The time() function returns a value in seconds (type time_t) while times() returns a set of values in clock ticks (type clock_t). Some historical implementations, such as 4.3 BSD, have mechanisms capable of returning more precise times (see below). A generalized timing scheme to unify these various timing mechanisms has been proposed but not adopted. Implementations in which time_t is a 32-bit signed integer (many historical implementations) fail in the year 2038. IEEE Std 1003.1-2001 does not address this problem. However, the use of the time_t type is mandated in order to ease the eventual fix. The use of the <time.h> header instead of <sys/types.h> allows compatibility with the ISO C standard. Many historical implementations (including Version 7) and the 1984 /usr/group standard use long instead of time_t. This volume of IEEE Std 1003.1-2001 uses the latter type in order to agree with the ISO C standard. 4.3 BSD includes time() only as an alternate function to the more flexible gettimeofday() function. FUTURE DIRECTIONS
In a future version of this volume of IEEE Std 1003.1-2001, time_t is likely to be required to be capable of representing times far in the future. Whether this will be mandated as a 64-bit type or a requirement that a specific date in the future be representable (for example, 10000 AD) is not yet determined. Systems purchased after the approval of this volume of IEEE Std 1003.1-2001 should be evaluated to deter- mine whether their lifetime will extend past 2038. SEE ALSO
asctime(), clock(), ctime(), difftime(), gettimeofday(), gmtime(), localtime(), mktime(), strftime(), strptime(), utime(), the Base Defini- tions volume of IEEE Std 1003.1-2001, <time.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 TIME(3P)
All times are GMT -4. The time now is 06:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy