systemtime

Given Date, Get Day of Week - SYSTEMTIME

空扰寡人 提交于 2019-12-07 00:33:28
问题 Is it possible to determine the day of the week, using SYSTEMTIME, if a date (month-day-year) is provided or is this structure one-way only? What is the most lightweight way to accomplish what I am asking if SYSTEMTIME cannot do it (using Win32)? 回答1: According to the msdn, the wDayOfWeek member is ignored when converting SYSTEMTIME to FILETIME . When converting back, it's filled in. SYSTEMTIME t = { 2010, 6, -1 /*ignored*/, 11 }; FILETIME ft; HRESULT hrto = SystemTimeToFileTime( &t, &ft );

Changing Android system clock stops timers. How can I restart them?

风流意气都作罢 提交于 2019-12-06 22:58:50
问题 I need to run a periodic task in an Android application. I currently use a timer like this: final Handler guiHandler = new Handler(); // the task to run final Runnable myRunnable = new Runnable() { @Override public void run() { doMyStuff(); } }; Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { guiHandler.post(myRunnable); } }, 0, 30000); // run every 30 seconds This does exactly what I need, but there is a problem: if I change the time on the emulator

Modifying the date and time values using SYSTEMTIME, FILETIME, and ULARGE_INTEGER

*爱你&永不变心* 提交于 2019-12-06 22:43:07
问题 I am making a program, in C++ using Visual Studio 2005, that needs to create a watermark with the time on a set of images. These images are taken from a video that were processed at certain time intervals. What I am trying to do is to modify the time on each image through SYSTEMTIME. I looked at the MSDN and it says not to modify the values within SYSTEMTIME itself, but to convert it into a FILETIME and then an ULARGE_INTEGER. My question is how is the ULARGE_INTEGER split up? Is the HighPart

Modifying the date and time values using SYSTEMTIME, FILETIME, and ULARGE_INTEGER

北战南征 提交于 2019-12-05 03:28:06
I am making a program, in C++ using Visual Studio 2005, that needs to create a watermark with the time on a set of images. These images are taken from a video that were processed at certain time intervals. What I am trying to do is to modify the time on each image through SYSTEMTIME. I looked at the MSDN and it says not to modify the values within SYSTEMTIME itself, but to convert it into a FILETIME and then an ULARGE_INTEGER. My question is how is the ULARGE_INTEGER split up? Is the HighPart the date and the Low Part the time and if that's the case how to I take into account rollover? Like if

Changing Android system clock stops timers. How can I restart them?

一世执手 提交于 2019-12-05 03:19:16
I need to run a periodic task in an Android application. I currently use a timer like this: final Handler guiHandler = new Handler(); // the task to run final Runnable myRunnable = new Runnable() { @Override public void run() { doMyStuff(); } }; Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { guiHandler.post(myRunnable); } }, 0, 30000); // run every 30 seconds This does exactly what I need, but there is a problem: if I change the time on the emulator or phone, the timer stops running. This is what appears in the log when I change the time: D

performing Arithmetic on SYSTEMTIME

左心房为你撑大大i 提交于 2019-12-05 01:22:41
问题 I have a time value represented in SYSTEMTIME, i want to add/subtract 1 hour from it and get the newly obtained SYSTEMTIME. I want the conversion should take care of the date change on addition/subtraction or month change or e1 year change . Can someone help me with this if there is some windows api which does arithmetic on SYSTEMTIME 回答1: If you're using C# (or VB.NET, or ASP.NET) you can use DateTime dt = DateTime.Now.AddHours(1); You can use negative numbers to subtract: DateTime dt =

performing Arithmetic on SYSTEMTIME

断了今生、忘了曾经 提交于 2019-12-03 16:00:28
I have a time value represented in SYSTEMTIME, i want to add/subtract 1 hour from it and get the newly obtained SYSTEMTIME. I want the conversion should take care of the date change on addition/subtraction or month change or e1 year change . Can someone help me with this if there is some windows api which does arithmetic on SYSTEMTIME Marco If you're using C# (or VB.NET, or ASP.NET) you can use DateTime dt = DateTime.Now.AddHours(1); You can use negative numbers to subtract: DateTime dt = DateTime.Now.AddHours(-1); EDITED: I extract an asnwer from this post They suggest converting SYSTEMTIME

Is there a function like asctime_s() that works for SYSTEMTIME structures in windows?

僤鯓⒐⒋嵵緔 提交于 2019-12-01 22:03:38
I know I can do this if I have a struct tm structure, but what if I want to do the same thing with a SYSTEMTIME. I could do this manually but just wondering if there's function that does this already. Thanks void PrintTimeSCII(struct tm *time) { char timebuf[26] = {0}; asctime_s(timebuf, 26, time); printf("%s\n", timebuf); } Michael GetDateFormat can be used for this. It can format the date using the appropriate format for a given locale. Below code shows how to use it for the user's default locale, in short format. char timebuf[26]; GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &sysTime,

I can't get SetSystemTime to work in Windows Vista using C# with Interop (P/Invoke)

青春壹個敷衍的年華 提交于 2019-12-01 15:11:05
I'm having a hard time getting SetSystemTime working in my C# code. SetSystemtime is a kernel32.dll function. I'm using P/invoke (interop) to call it. SetSystemtime returns false and the error is "Invalid Parameter". I've posted the code below. I stress that GetSystemTime works just fine. I've tested this on Vista and Windows 7. Based on some newsgroup postings I've seen I have turned off UAC. No difference. I have done some searching for this problem. I found this link: http://groups.google.com.tw/group/microsoft.public.dotnet.framework.interop/browse_thread/thread/805fa8603b00c267 where the

I can't get SetSystemTime to work in Windows Vista using C# with Interop (P/Invoke)

眉间皱痕 提交于 2019-12-01 12:41:58
问题 I'm having a hard time getting SetSystemTime working in my C# code. SetSystemtime is a kernel32.dll function. I'm using P/invoke (interop) to call it. SetSystemtime returns false and the error is "Invalid Parameter". I've posted the code below. I stress that GetSystemTime works just fine. I've tested this on Vista and Windows 7. Based on some newsgroup postings I've seen I have turned off UAC. No difference. I have done some searching for this problem. I found this link: http://groups.google