The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 tm_yday not working in function systemtime_to_tm()

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
newuser_ca Posted - 11/15/2011 : 3:52:23 PM
when I convert systemtime to tm format, "tm_yday" shows "0".
The others (tm_sec, tm_min, etc) are ok.

My codes are:
/////////////////////////////////////
SYSTEMTIME systime;
TM t;
GetSystemTime(&systime);
systemtime_to_tm(&t, &systime);
////////////////////////////////////
2   L A T E S T    R E P L I E S    (Newest First)
newuser_ca Posted - 11/16/2011 : 09:24:34 AM
Thanks a lot.
It solves the problem.
Penn Posted - 11/15/2011 : 10:23:48 PM
Hi,

This is a bug. For now, you can set this value manually, for example:

// use Day function to get day of year, need to declare first
int Day(double date, int option = 1);  // option = 1 for month day, = 2 for year day


void testSYSTEMTIME_TM()
{
	SYSTEMTIME systime;
	TM t;
	GetSystemTime(&systime);
	systemtime_to_tm(&t, &systime);

	double lpdDate;
	SystemTimeToJulianDate(&lpdDate, &systime);  // get Julian date from SYSTEMTIME
	int nYDay = Day(lpdDate, 2);  // get day of year
	if(nYDay >= 0)
		t.tm_yday = nYDay;  // set tm_yday
}


Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000