Got it ..
actually, I didn't know that I can access the time index with time(tempBS)
....

Browse[1]> t <- head(tempBs)
Browse[1]> t
                        ..1   ..2 ..3 pnlSlice
2011-06-03 13:32:24.975 242 99125   1      -75
2011-06-03 13:32:55.036 242 99100  -1      -25
2011-06-03 13:36:10.490 242 98850  -1      -50
2011-06-03 13:36:59.064 242 98775   2       25
2011-06-03 13:38:21.795 242 98550  -2     -200
2011-06-03 13:40:01.725 242 98825   1     -450
Browse[1]> time(t)
[1] "2011-06-03 13:32:24.975 CEST" "2011-06-03 13:32:55.036 CEST"
[3] "2011-06-03 13:36:10.490 CEST" "2011-06-03 13:36:59.064 CEST"
[5] "2011-06-03 13:38:21.795 CEST" "2011-06-03 13:40:01.725 CEST"
Browse[1]> time(t) - start(t)
Time differences in secs
[1]   0.000  30.061 225.515 274.089 356.820 456.750
Browse[1]> time(t)
[1] "2011-06-03 13:32:24.975 CEST" "2011-06-03 13:32:55.036 CEST"
[3] "2011-06-03 13:36:10.490 CEST" "2011-06-03 13:36:59.064 CEST"
[5] "2011-06-03 13:38:21.795 CEST" "2011-06-03 13:40:01.725 CEST"
Browse[1]> as.numeric(time(t))
[1] 1307100745 1307100775 1307100970 1307101019 1307101102 1307101202
Browse[1]> as.double(time(t))
[1] 1307100745 1307100775 1307100970 1307101019 1307101102 1307101202
Browse[1]> index(t)
[1] "2011-06-03 13:32:24.975 CEST" "2011-06-03 13:32:55.036 CEST"
[3] "2011-06-03 13:36:10.490 CEST" "2011-06-03 13:36:59.064 CEST"
[5] "2011-06-03 13:38:21.795 CEST" "2011-06-03 13:40:01.725 CEST"
Browse[1]>


Last question here, as.numeric(time(t)) returns seconds since 1970, but not
the milliseconds, although I enabled it through setting the mentioned
options. Any hint on that?

Thanks
Ulrich







On Sun, Jun 5, 2011 at 8:33 PM, Dirk Eddelbuettel <edd@debian.org> wrote:

>
> On 5 June 2011 at 20:14, Ulrich Staudinger wrote:
> | Hi Dirk,
> |
> | but I don't have a POSIXct object, I have an xts time series object and
> want
>
> Are you sure?  What does
>
>    class( index ( tempBs ) )
>
> return?  And are you sure that time index for xts cannot be casted into
> POSIXct?
>
> | the timestamps as seconds/milliseconds with the goal to save it to a
> database
> | ...
>
> Yes. POSIXct is 'just' a double with millseconds resolution which can be
> passed down to C/C++, stored in a DB, etc pp with ease just because it can
> reduce to a double (if you are willing to forego attributes such as local
> timezones etc).
>
> Dirk
>
> --
> Gauss once played himself in a zero-sum game and won $50.
>                      -- #11 at http://www.gaussfacts.com
>



-- 
Ulrich Staudinger
http://www.activequant.org
<https://www.xing.com/profile/Ulrich_Staudinger>

	[[alternative HTML version deleted]]

