Sponsored Content
Full Discussion: struct tm problem
Top Forums Programming struct tm problem Post 96439 by bankpro on Friday 20th of January 2006 05:27:36 AM
Old 01-20-2006
struct tm problem

I receive an integer as argument for a function.
within function definition i want it to be of type struct tm.

eg..
main()
{
int a;
......
}
function(...,..,a,..)
int a;
{
struct tm tm;
if(!a)
^ time(&a);
^ memcpy(&tm,localtime(&LogTime),sizeof(struct tm));

}

gives me error at the line ^ why ?
 

10 More Discussions You Might Find Interesting

1. Programming

Struct Initialization

Hi We are using a code generator for initializing structures with the #define macro. Compiling it with the GCC 2.8.1 (with -ansi) it OK. But when we are using the SUN C 5.0 compiler it screams. Following is a code sample: #include <stdlib.h> #include <stdio.h> typedef struct TEST3 {... (4 Replies)
Discussion started by: amatsaka
4 Replies

2. Programming

Problem accessing struct member

I have a struct as follows... struct A { int a; ucontext_t X; //ucontext_t is another structure } How do I define a pointer to the above structure variable X of the type ucontext_t from within another function? eg. void foo() { struct A a; /////WHAT COMES IN... (1 Reply)
Discussion started by: jacques83
1 Replies

3. Programming

Struct Array

in my .c file i have a struct atop of the program defined as follows: #define MAX 10 int curtab; static struct tab { int count; int use; } tab; with the initial function following it like so: int tab_create(int init_count) { int i; for(i=0; i < MAX; i++) {... (1 Reply)
Discussion started by: micmac700
1 Replies

4. UNIX for Advanced & Expert Users

problem with netfilter hook function struct skbuff *sock is null..

iam trying to built a firewall.so i have used netfilter for it. in function main_hook sock_buff is returning null and in my log file continuously "sock buff null" is printed plse help to solve this problem.. (using print_string iam printing strings on current terminal (terminal we ping)) ... (1 Reply)
Discussion started by: pavan6754
1 Replies

5. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

6. Programming

Compiling virtual network adapter driver problem (net_device struct)

Hi, I found on linuxgazette.net/93/bhaskaran.html page very useful sample of virtual driver (not connected to real hardware). I try to compile it with no effect. So: I got fresh Ubuntu 9.10 (kernel 2.6.31-14) My source is saved in networkAdapter.c file in /usr/src/myModules directory. I... (21 Replies)
Discussion started by: Chrisdot
21 Replies

7. UNIX for Dummies Questions & Answers

struct winsize

what is struct winsize used for? i tried looking it up, but no luck. (0 Replies)
Discussion started by: l flipboi l
0 Replies

8. Programming

Problem defining a struct

I have the following code and getting the compilation errors baseLib/DynBaseObj.h:80: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:89: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:101:... (0 Replies)
Discussion started by: kristinu
0 Replies

9. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

10. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies
PMLOCALTIME(3)						     Library Functions Manual						    PMLOCALTIME(3)

NAME
pmLocaltime - convert the date and time for a reporting timezone C SYNOPSIS
#include <time.h> #include <pcp/pmapi.h> struct tm *pmLocaltime(const time_t *clock, struct tm *result); cc ... -lpcp DESCRIPTION
pmLocaltime is very similar to localtime(3), except the timezone used is the current ``reporting timezone'' (rather than the default TZ environment variable scheme), and the result is returned into a caller-declared buffer (rather than a private buffer). Like localtime(3) the time to be converted is passed via clock, and the result contains the components broken out in the elements of the tm struct. pmLocaltime returns result as the value of the function. The default current reporting timezone is as defined by the TZ environment variable, so pmLocaltime and localtime(3) will initially produce a similar encoding of the date and time. Use pmNewZone(3), pmNewContextZone(3) or pmUseZone(3) to establish a new current reporting timezone that will affect pmLocaltime but not localtime(3). SEE ALSO
localtime(3), PMAPI(3), pmCtime(3), pmGetConfig(3), pmNewContextZone(3), pmNewZone(3), pmUseZone(3), pcp.conf(5) and pcp.env(5). Performance Co-Pilot PCP PMLOCALTIME(3)
All times are GMT -4. The time now is 04:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy