<DURATION> XML Element as TimeSpan

M

Martin Russ

Hi,

I'm trying to unravel the <DURATION> element of the Tasks element of a
Project .XML file. The information stored in the <DURATION> element is e.g.
PT80H0M0S - which I know from looking at it and the data is 80 hours, 0
minutes and 0 seconds.

However, I cannot see how this translates into a TIMESPAN structure as is
indicated in the documentation.

Can somebody please help point me in the right direction?

Thanks,
Martin Russ
 
J

JackD

Duration = Finish - Start
taking into account the working calendar.

In the documentation (typically C:\Program Files\Microsoft
Office\Office10\1033\PROJXML.HTM) I do not find reference to any TIMESPAN
structure.

If you are talking about timephasedData then the relationship is there but a
bit tenuous. TimephasedData is based on start and finish times for
particular units (days, weeks etc.) These do not necessarily match the start
and finish for the task.
 
J

JackD

It says that duration is a "timespan" datatype.
Looking up timespan you can find it in the .net framework as a ValueType.
------------snip-------------

The value of an instance of TimeSpan represents a period of time. That value
is the number of ticks contained in the instance and can range from
Int64.MinValue to Int64.MaxValue. A tick is the smallest unit of time that
can be specified, and is equal to 100 nanoseconds. Both the specification of
a number of ticks and the value of a TimeSpan can be positive or negative.

A TimeSpan can be represented as a string in the format "[-]d.hh:mm:ss.ff"
where "-" is an optional sign for negative TimeSpan values, the "d"
component is days, "hh" is hours, "mm" is minutes, "ss" is seconds, and "ff"
is fractions of a second. For example, a TimeSpan initialized to 1.0e+13
ticks represents "11.13:46:40", which is 11 days, 13 hours, 46 minutes, and
40 seconds.

Due to a varying number of days in months and years, the longest unit of
time that is used by TimeSpan is the day.

----------snip----------

So it appears that the timespan refered to in the link you provided is
consistant with what microsoft defines as a timespan with the exception that
it has a "pt" in front of it.
The .net framework offers a number of operators for working with timespans.

I guess I'm still not sure what your question is though.
 
M

Martin Russ

Well, the format of the element string bears no relation to that of a
TIMESPAN datatype as indicated in the documentation. Therefore, if it's not
a TIMESPAN, what is it?

JackD said:
It says that duration is a "timespan" datatype.
Looking up timespan you can find it in the .net framework as a ValueType.
------------snip-------------

The value of an instance of TimeSpan represents a period of time. That value
is the number of ticks contained in the instance and can range from
Int64.MinValue to Int64.MaxValue. A tick is the smallest unit of time that
can be specified, and is equal to 100 nanoseconds. Both the specification of
a number of ticks and the value of a TimeSpan can be positive or negative.

A TimeSpan can be represented as a string in the format "[-]d.hh:mm:ss.ff"
where "-" is an optional sign for negative TimeSpan values, the "d"
component is days, "hh" is hours, "mm" is minutes, "ss" is seconds, and "ff"
is fractions of a second. For example, a TimeSpan initialized to 1.0e+13
ticks represents "11.13:46:40", which is 11 days, 13 hours, 46 minutes, and
40 seconds.

Due to a varying number of days in months and years, the longest unit of
time that is used by TimeSpan is the day.

----------snip----------

So it appears that the timespan refered to in the link you provided is
consistant with what microsoft defines as a timespan with the exception that
it has a "pt" in front of it.
The .net framework offers a number of operators for working with timespans.

I guess I'm still not sure what your question is though.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Martin Russ said:
Jack,

Take a look at the MSDN Project 2003 SDK documentation at the following URL
for the DURATION element.

http://msdn.microsoft.com/library/en-us/pjsdk/html/pjxml_elemDuration.asp?frame=true

Thanks,
Martin Russ
 
J

JackD

The documentation I pointed out to you before showed that it is a duration
datatype.
Did you read projxml.htm? You probably should as it will help you
understand. The project duration datatype follows the w3 spec for duration
datatype.

http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#duration

Then I pointed you to documentation which shows you that converting to a
..net timespan datatype is possible and that they are hardly incompatible. If
you want to do this, there are methods to do it and you should find it
possible to translate as you have requested. There IS a clear relationship
between the two.

http://msdn.microsoft.com/library/d...nconvertingstringstonetframeworkdatatypes.asp

If you are just pointing out that the SDK documentation is wrong well, that
is another story. Yes, it is wrong. The xml is in a duration datatype, but
that doesn't really help you solve your problem.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Martin Russ said:
Well, the format of the element string bears no relation to that of a
TIMESPAN datatype as indicated in the documentation. Therefore, if it's not
a TIMESPAN, what is it?

JackD said:
It says that duration is a "timespan" datatype.
Looking up timespan you can find it in the .net framework as a ValueType.
------------snip-------------

The value of an instance of TimeSpan represents a period of time. That value
is the number of ticks contained in the instance and can range from
Int64.MinValue to Int64.MaxValue. A tick is the smallest unit of time that
can be specified, and is equal to 100 nanoseconds. Both the specification of
a number of ticks and the value of a TimeSpan can be positive or negative.

A TimeSpan can be represented as a string in the format "[-]d.hh:mm:ss.ff"
where "-" is an optional sign for negative TimeSpan values, the "d"
component is days, "hh" is hours, "mm" is minutes, "ss" is seconds, and "ff"
is fractions of a second. For example, a TimeSpan initialized to 1.0e+13
ticks represents "11.13:46:40", which is 11 days, 13 hours, 46 minutes, and
40 seconds.

Due to a varying number of days in months and years, the longest unit of
time that is used by TimeSpan is the day.

----------snip----------

So it appears that the timespan refered to in the link you provided is
consistant with what microsoft defines as a timespan with the exception that
it has a "pt" in front of it.
The .net framework offers a number of operators for working with timespans.

I guess I'm still not sure what your question is though.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Martin Russ said:
Jack,

Take a look at the MSDN Project 2003 SDK documentation at the
following
URL
for the DURATION element.
http://msdn.microsoft.com/library/en-us/pjsdk/html/pjxml_elemDuration.asp?frame=true
Thanks,
Martin Russ

:


Duration = Finish - Start
taking into account the working calendar.

In the documentation (typically C:\Program Files\Microsoft
Office\Office10\1033\PROJXML.HTM) I do not find reference to any TIMESPAN
structure.

If you are talking about timephasedData then the relationship is
there
but a
bit tenuous. TimephasedData is based on start and finish times for
particular units (days, weeks etc.) These do not necessarily match
the
start
and finish for the task.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
Hi,

I'm trying to unravel the <DURATION> element of the Tasks element of a
Project .XML file. The information stored in the <DURATION>
element
is
e.g.
PT80H0M0S - which I know from looking at it and the data is 80
hours,
0
minutes and 0 seconds.

However, I cannot see how this translates into a TIMESPAN
structure as
is
indicated in the documentation.

Can somebody please help point me in the right direction?

Thanks,
Martin Russ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top