How to detect system date change in MFC

Hi,

I am developing a secruity surveillance application, where i am
recording videos from a CCTV camera. I have to record the videos in
that particular days directory in date tree format. The thing is when
the system date changes to a different date i should be able to detect
that and start recording the videos in a different directory. I know i
can use the settimer and ontimer functions, but say the settimer is
called at 23.30 and the duration is set to 1 hr then the ontimer event
will fire at 00.30 am its already half an hour into the next day. Is
there any inherent way of detecting the system date change and
handling it? I want to start recording videos in a different directory
the moment the system clock changes from 23.59 to 00.00. Is there a
way this can be done?

Thanks
Bharath
0
3/4/2008 10:05:30 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
304 Views

Similar Articles

[PageSpeed] 50

Take a look at SetWaitableTimer, that's the only timer I know of that can do 
absolute time.

AliR.


"bharath_r" <bharath.0523@gmail.com> wrote in message 
news:25bf2023-68bd-4ff2-a774-da90f71e3ece@s12g2000prg.googlegroups.com...
> Hi,
>
> I am developing a secruity surveillance application, where i am
> recording videos from a CCTV camera. I have to record the videos in
> that particular days directory in date tree format. The thing is when
> the system date changes to a different date i should be able to detect
> that and start recording the videos in a different directory. I know i
> can use the settimer and ontimer functions, but say the settimer is
> called at 23.30 and the duration is set to 1 hr then the ontimer event
> will fire at 00.30 am its already half an hour into the next day. Is
> there any inherent way of detecting the system date change and
> handling it? I want to start recording videos in a different directory
> the moment the system clock changes from 23.59 to 00.00. Is there a
> way this can be done?
>
> Thanks
> Bharath 


0
AliR3470 (3236)
3/4/2008 4:09:26 PM
SetTimer/OnTimer for an hour would, as you observe, be a poor choice here.  Typically, you
would never do a SetTimer for an hour; you would commonly use a value such as 60000 (one
minute) or perhaps even 300000 (five minutes).  Sure, some log entries might end up in the
wrong directory, but that's life.  A couple minutes' error should be expected.

When I built such a system a decade ago, we checked the current date every minute.  It was
good enough.

You might also consider handling a system date/time change event (which I believe will
include Daylight Savings Time events), responding to WM_TIMECHANGE.  CWnd::OnTimeChange
will receive the notification that the system clock has changed.
					joe

On Tue, 4 Mar 2008 02:05:30 -0800 (PST), bharath_r <bharath.0523@gmail.com> wrote:

>Hi,
>
>I am developing a secruity surveillance application, where i am
>recording videos from a CCTV camera. I have to record the videos in
>that particular days directory in date tree format. The thing is when
>the system date changes to a different date i should be able to detect
>that and start recording the videos in a different directory. I know i
>can use the settimer and ontimer functions, but say the settimer is
>called at 23.30 and the duration is set to 1 hr then the ontimer event
>will fire at 00.30 am its already half an hour into the next day. Is
>there any inherent way of detecting the system date change and
>handling it? I want to start recording videos in a different directory
>the moment the system clock changes from 23.59 to 00.00. Is there a
>way this can be done?
>
>Thanks
>Bharath
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
3/4/2008 4:50:37 PM
On Mar 4, 9:50=A0pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> SetTimer/OnTimer for an hour would, as you observe, be a poor choice here.=
 =A0Typically, you
> would never do a SetTimer for an hour; you would commonly use a value such=
 as 60000 (one
> minute) or perhaps even 300000 (five minutes). =A0Sure, some log entries m=
ight end up in the
> wrong directory, but that's life. =A0A couple minutes' error should be exp=
ected.
>
> When I built such a system a decade ago, we checked the current date every=
 minute. =A0It was
> good enough.
>
> You might also consider handling a system date/time change event (which I =
believe will
> include Daylight Savings Time events), responding to WM_TIMECHANGE. =A0CWn=
d::OnTimeChange
> will receive the notification that the system clock has changed.
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 joe
>
>
>
>
>
> On Tue, 4 Mar 2008 02:05:30 -0800 (PST), bharath_r <bharath.0...@gmail.com=
> wrote:
> >Hi,
>
> >I am developing a secruity surveillance application, where i am
> >recording videos from a CCTV camera. I have to record the videos in
> >that particular days directory in date tree format. The thing is when
> >the system date changes to a different date i should be able to detect
> >that and start recording the videos in a different directory. I know i
> >can use the settimer and ontimer functions, but say the settimer is
> >called at 23.30 and the duration is set to 1 hr then the ontimer event
> >will fire at 00.30 am its already half an hour into the next day. Is
> >there any inherent way of detecting the system date change and
> >handling it? I want to start recording videos in a different directory
> >the moment the system clock changes from 23.59 to 00.00. Is there a
> >way this can be done?
>
> >Thanks
> >Bharath
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text -
>
> - Show quoted text -

Thanks for all the help. It was really helpfull.

Regards
Bharath
0
3/6/2008 2:01:04 PM
Reply:

Similar Artilces:

send the same e-mail with one or two fields changed.......
I would like to send the same e-mail to many differnet people with one or two fields changed (for example the name of recipient and the date).How canthis be done?? I would also like to be able to save the e-mail and use it again and again. can anyone help cheers john If you have Word installed and it's the same version as Outlook (both 2003, for example), you can do a mail merge between the two. This would allow you to set up the text the way you want it to, and you can save the document for future use. Look at the following page for further information: http://www.slipstick.com/con...

why does sorting change a scatter plot graph?
Why does the way a spread sheet is sorted change the look of a scatter plot graph??? the graph is just a plot of two points, (X, Y) and these two points are definded by two collumns for a given row. The two collumns don't change, and the row all stays together, so why does it change where points are plotted out on the graph when you re-sort it? AndrewT420 - Usually, for an XY (Scatter) chart, with values of X in a column and corresponding values of Y in an adjacent column, for three or more points, Excel assumes (correctly) "Series in Columns." But, when you have only...

Date display in Excel
Format column of cells as Date, display as mm/dd/yy. Date entered into cell, shows up correctly in the text entry field at the top of the screen, but the data on the worksheet displays as "33747", or similar number. Only happening on one workbook. Try tools|options|View tab|uncheck Formulas. Clark wrote: > > Format column of cells as Date, display as mm/dd/yy. Date > entered into cell, shows up correctly in the text entry > field at the top of the screen, but the data on the > worksheet displays as "33747", or similar number. Only > happening on one...

Outlook 2003
Just bought new PC. Everything is Microsoft. XP Home - Microsoft Works (came installed) - User like to use MSN for e-mail, Sent Microsoft $300.00 to activate Office that came installed on machine. Word will not allow MSN to be the e-mail client. System crashed and burned after activation of Office. Outlook 2003 seems a little unstable. Why would a new PC with Works, Office Express and Outlook 2003 be shipped? All these programs do the same thing and they don't seem to talk with each other well. On top of this all she wants to do is use Word and send the document through MSN nor...

Changing Prices in HQ.
Hi, I have this little issue. I want to change the put items on promotion using the price wizard using HQ. Unfortunately if I have stores who has differents prices for a same item the wizard do not make the proper change becuase it use the price already stored in the master table. Does anyone saw this issue before? Who was solved?. Thks in advance for your help. Rgds Rodrigo Hi there, The easiest way to look after this is to not change any data on the ITEM in HQ, but to simply do the worksheet for altering the sale price and then send it to the respective stores. Then in the works...

Content of emails is changing without any reason !
Hallo I changed operating system last week. From Win XP to Win 7. Used to work with Outlook Express at full satisfaction. I could transfer most of my emails automatically with export/import features of Microsoft software. But I suddenly discover 1 very big problem (bug ???) I am used to work with several maps, and hereby go to several levels deep. Such as : Saved mails Companyname Projectname Date of action Department Activity Name of patient Different emails So sometimes maps can go several levels deep. When I check ema...

How to Debug MFC dll
I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the other MFC dll. I am loading the MFC dll from my MFC app. If I set breakpoints in the MFC dll code, it doesn't stop there. How do I debug the dll ? Regards, Amit Is the DLL linked in with the App or do you dynamically load it? AliR. "Cagespear" <Cagespear@discussions.microsoft.com> wrote in message news:C19EC4DF-2AC0-4BD3-B1C3-4C356A4EDF4C@microsoft.com... >I have a VS 2003 soln with 2 projects - 1 MFC Dialog based app and the >other > MFC dll. > > I am loading the MFC dll from my...

Saving toolbar changes
After spending a lot of time to customize a toolbar in Excel 2003, it disappears when opening up another file, or starting the app again. I repeatedly change it, save it as XLB, XLT, save multiple copies in every possible location...but the damn thing always defaults to its own toolbar settings. This makes toolbars almost useless. How can one insist that PPT use YOUR toolbar setting, rather than its own default Thanks. Hi Jeff, If I have a lot of tool bar changes to make, I close all the workbook that are not hidden then unhide my personal.xls from the Window menu. I don't know why...

C# Adding Days to a Date
Hello, I have 2 objects: objContract.activeon and objContract.expireson. I am trying to add 364 days to objContract.activeon and assign it to the value of objContractexpireson. ---------------------------------------------------------- // Contract Start Date DateTime dt = DateTime.Now; objContract.activeon = new CrmDateTime(); int iFound = 0; string sTemp = ""; if (objAccount.paymenttermscode.Value == 1) // due on receipt - use Todays Date { objContract.activeon = objInvoice.CFDinvoicedate; } else // ...

Change cannot be saved due to sharing violation
Hello I've this message while saving the excel file even if no change ha been done to the file. There is no share on this file (exclusive use) File resides on a network drive It's very disturbing Thanks for your help Vobiscu -- Vobiscu ----------------------------------------------------------------------- Vobiscum's Profile: http://www.msusenet.com/member.php?userid=245 View this thread: http://www.msusenet.com/t-187102186 http://support.microsoft.com/default.aspx?scid=kb;en-us;328170 Thanks for your answer, I will try tomorrow noo Vobiscu -- Vobiscu ----------------...

Adding support for mfc / atl types in a Win32 project
MSDN says this about adding support for classes shared between atl & mfc (I'm just after points and rects btw)... just add the header ( atltypes.h ). I'm getting linker errors for these classes though. Is there a lib I need to add? Any screwy build options need changing? It's in VC 2003. In the project wizard I note that atl and mfc support aren't available when creating an empty Win32 application. Ta. On 26 May 2006 07:42:09 -0700, Simon L wrote: > MSDN says this about adding support for classes shared between atl & > mfc (I'm just after points and rect...

Changing query execution sequence
Hi all, I got a spreadsheet which would execute a bunch of queries. It's noted that the queries are executing in the sequence of when it was added to the spreadsheet. Does anyone out there know of a way to switch the order without deleting and recreating them? Thanks! Wing ...

Separating Date and Time in a cell
I have a column of cells in the format "11/01/02 06:21". I would like to separate the text into 2 cells - one with the date and the other with the time. My attempts with LEFT and RIGHT have been unsuccesful. Thanks for your help Sameer --- Message posted from http://www.ExcelForum.com/ For the date use =INT(A1) replace A1 with the first cell of your range for time =MOD(A1,1) you probably have to reformat the first to mm/dd/yy (or whatever the setting is) and hh:mm Note that you can do this by just using format but if you want to compare to other cells with just pure d...

Preventing dissambly/decompiliation of MFC Apps and DLLs
Hello, I was wondering if there are any software products out there that will take a compiled MFC app or MFC DLL and prevent the files from being disassemble or being decompiled? Sincerely, James Simpson James Simpson wrote: > Hello, > I was wondering if there are any software products out there that will take > a compiled MFC app or MFC DLL and prevent the files from being disassemble or > being decompiled? > > Sincerely, > > James Simpson > Whether or not MFC is used is irrelevant. There is no way to prevent or even resist disassembly. If it is execut...

Automatic changes in cells
Hi for some reason I now have to save my work for any formlas etc to change when I update a worsheet, how can I stop this as it is a pain and sometimes I need to do changes to see how they work before saving the work. Many thanks Click on Tools | Options | Calculation tab and set to Automatic calculation, as it is probably set to Manual. You can press F9 to force a recalculation under a manual setting. Make sure you save the file with the Automatic setting, to avoid it happening next time. Hope this helps. Pete On Feb 1, 11:42=A0am, Office 2004 Test Drive User <heepenm...@yahoo.co.u...

Change the text of a shape rather than its master
Hi, I build custom masters by mixing two general shapes, say square and circle together, and have text on both the shapes. But after I drop an instance of the master into a page, I cannot modify the text of the instance. To do so, I need to modify the text on the master, which is non-sense for me. How to change the text of a shape without modifying its master? Thanks! How are you doing this? By code or by the UI? Are you grouping the shapes? If you drag two shapes to the stencil, it will group the shapes. So instead of a square and a circle you have three shapes. A Square, Circle and the...

cell colour change when set markers are reached
i need to get a cell to change colour when markers are reached eg a qualification lasts 12 months. what i want to do is have the cell change from yellow to orange to red as the expiry date gets closer. If column A contains expiry dates then select column A, Formats>Conditional Formatting>formula1: =DATEDIF(TODAY(),A1,"m")<1 red for 1 month Click Add button, formula2: =DATEDIF(TODAY(),A1,"m")<2 orange for 2 month Click Add button, formula3: =DATEDIF(TODAY(),A1,"m")<3 yellow for 3 month Adjust number of months as you like! Regards,...

date function #3
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C73005.0FA093A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have a cell A1 with date 5/2/07. If in cell A2 I do month(A1), I get = 5. Is there a way to return May instead? either through a command or = formatting? I can reference cell A2 with the 5 with a if(cell =3D 5, = "May", ) in cell A3, but the date in cell A1 varies from Jan to Dec and = the 12 embedded if's in cell A3 are too long (that is the error I get = when trying to do so), plus i...

Changing ip address of exchange server #2
Hi, I have a back-end server and a smtp server in DMZ. I want to change ip address of back-end server. are there any issues? all incoming and outgoing emails are going via smart host. Hi, No issues at all as long as you remember to change all the references to this server in your firewall, SMTP scanner etc. Leif "Jack Dorson" <JackDorson@discussions.microsoft.com> wrote in message news:FE5927A1-D20D-4C6B-991F-2E1EFD19434D@microsoft.com... > Hi, > > I have a back-end server and a smtp server in DMZ. > > I want to change ip address of back-end server. are ...

How to change a background color with Publisher
How can I click on to a background color and change that background color to another color using Publisher? Ron Williams wrote: > How can I click on to a background color and change that background > color to another color using Publisher? ====================== Try these steps... Double left click the color you want to change and a Format screen should open that has a drop window with color choices. -- J. Inzer MS-MVP Digital Media Experience Notice This is not tech support I am a volunteer Solutions that work for me may not work fo...

how do I change date format in the header in Excel XP ?
I need to chage my date format, in the header to Day; Month DD, YYYY ie. Saturday; May 23, 2005. Woudl you please help me out ? Thank you. Regards, Hesam Shakourian Check this out. http://support.microsoft.com/?kbid=213742 but change the format to "dddd, MMMM dd, yyyy" "Hesam" <Hesam@discussions.microsoft.com> wrote in message news:93495F75-4196-4208-9C0D-E800BCAE3A89@microsoft.com... > I need to chage my date format, in the header to Day; Month DD, YYYY > ie. Saturday; May 23, 2005. > > Woudl you please help me out ? > > Thank you. > &g...

Change Domain Name on outgoing Emails
Our company just purchased another company with their own Exchange Server and AD infrastrure. We want all users in this new facility to have Email addresses with our Domain such as username@abc.com instead of their current Domain username@123.com. Until I migrate resources from their Forest into our Forest I have created contacts to forward all Emails from the abc Domain to the 123 Domain. When users reply or send Emails from the 123 Domain it still has their username@123.com Email address which will cause confusion with our customers and suppliers. How do I force their Emails to us...

Option trades with past expiry dates not showing up in Portfolio M
Hello: Money 2006 Portfolio Manager does not show closed option trades that have expiry dates in the past, even when the "show closed positions" is checked. The transactions are still there in the investment accounts, just not visible in portfolio manager. I just called microsoft support and have notified them of the issue and hope that this issue is fixed as an update. If not, it pretty much makes the portfolio manager (and Microsoft Money 2006) useless for option trading investors. "MumbaiBabu" <MumbaiBabu@discussions.microsoft.com> wrote in message news:1...

How to change PERMANENTLY environment variables from batch script?
Ok, I know. In a batch file I can change environment variables temporarily (=for the current, remaining session) be entering e.g. set CLASSPATH=D:\newpath;%CLASSPATH% However these changes are not visible outside of the current session and furthermore they are lost after a reboot. Is there a(nother) way to change them PERMANENTLY from batch script? I can imagine that there is a way by a regedit or VisualBasic script or 3rd party cmdline tool. Again: I don't want to edit them manually e.g. in the "System" dialog in control panel. The change should take place on ...

How do I change a spreadsheet from all caps to "Proper"
I have a spreadsheet containing data to make mailing labels. The whole thing was entered in caps. I need to change it to the Proper style ( the first letter is capitalized and the rest lower case). How can I do this? Hi see: http://www.cpearson.com/excel/case.htm -- Regards Frank Kabel Frankfurt, Germany "dumbfounded" <dumbfounded@discussions.microsoft.com> schrieb im Newsbeitrag news:C2E74629-E7E9-4B68-87FC-D49B91B83452@microsoft.com... > I have a spreadsheet containing data to make mailing labels. The whole thing > was entered in caps. I need to change it to the Pr...