DateTime.UtcNow is added as root attribute, 'Modified' of an xml whenever
xml is changed.
Every 5 secs a check is made whether xml is changed or not, by comparing
previous 'Modified' and current 'Modified'.
By considering performance in mind whats best to way of stroring and
calculating date in this case?
Is UtcNow best for comparing every 5 secs.?
Or is it better saving UtcNow.ticks and comparing it.?
How to get UtcNow.ticks in seconds/milliseconds?
UtcNow.ticks gives ticks from Jan 01, 0001. How to get it from another date,
say How to get ticks/milliseconds since jan 01, 1970 (as in case of
Javascript)?
thanks,
Praveen 2 1810
>From the computer's perspective, "every 5 seconds" is not very often,
so I would keep it simple and stick with the natural format, DateTime.
Less to go wrong.
For duration between 2 times, use Subtract, which gives you a
TimeSpan. Or simply subtact pre-caculate the ticks of your origin
date, and subtract this from the ticks for now - i.e. (notepad code -
not tested)
long origin = new DateTime(1970,1 ,1).Ticks; // note this is in local
time, not UTC
....
long ticks = DateTime.Now.Ti cks - origin; // so use local time here
also?
Can I ask what the scenario is here? What could change the xml? It is
a file? Something in memory? There may be other ways to monitor for
changes. Size of the xml, and the source (remote database vs in local
memory) makes a difference too.
Marc
OK - more or less what I suspected; just watch out for thread safety
when accessing the various objects. Web apps are multi-threaded.
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: rhaley |
last post by:
ugh. Okay, I need to figure out the number of milliseconds between
DateTime.Now and the end of the day so that I can make changes based on
the date roll-over. I need to implement a Timer so that I can process
things on the Timer.Elapsed event that would happen right at the date
change (unless there is a better suggestion to implement an event on
the date change). DateTime isn't so friendly to this calculation.
Please, any suggestions are...
|
by: William Bradley |
last post by:
I have two cells on a form. One of them is the "Production Date" and the
other is the "Expiry Date". The "Expiry Date" is 183 days after the
"Production Date."
On an Excel spreadsheet, the "Expiry Date" is automatically entered, when
the "Production Date" is entered. To do this the "Expiry Date" cell carries
the following formula: "=A15+183".
I would like to be able to do the same on an Access Form, with the results
written to the...
|
by: PeteCresswell |
last post by:
I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into Double
fields.
Now, the clients have just dropped a litle bomb: they want to see
"(NA)" if the calculation failed due to insufficient input data.
That means our fields can have three kinds of values:
|
by: John |
last post by:
Hi
I am using and access datetime field to store both date & time. How can I
split it into date & time after reading the field and then combine the date
& time back into datetime when storing it?
Thanks
Regards
|
by: Niyazi |
last post by:
Hi everyone,
I have a sql table that has 5 column as:
cl1Month - cl1_3Month - cl3_6Month - cl6_12Month - clMoreThan12Month
Now I have to date and I have to find the differences and check as month and
put into one of the above column.
If the diiferences is 0 or 30 days than value should be store in cl1Month.
| |
by: divya |
last post by:
Hi,
I have a table tblbwday with 2 fields Name and Birthday.I have written
this script for displaying evryday names of the people on that day.
<%
set objConn =server.createobject("ADODB.connection")
objConn.open "DSN=Photo"
Dim sqlSELsite,ObjRSSel
sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
|
by: sandraz444 |
last post by:
I have an expression in the query under my form to autofill the date
under a certain condition but it wont write to the underlying table??
The date shows in the form but not the table. Does anyone know a
solution for this?
Thanks!
|
by: jonny |
last post by:
Option Explicit
Private mdTarget1 As Date
Private mdTarget2 As Date
' called on form load
Public Sub SetRecordStartTime()
mdTarget1 = DateAdd("n", 60, Time)
mdTarget2 = DateAdd("n", 120, Time)
|
by: tuananh87vn |
last post by:
hi,
I have some problems related to date type:
In mysql, I created a table with some fields of date type, so how can I use php to insert date value in into database (then db will store date format, instead of breaking it into separate smaller attributes: date, month, year...with int type like i did before- I don't like it)
Then when I call out these value, how can I perform calculation (in php, of course). For example: how many days from...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |