Re: [Rd] How to convert time_t to R date object

2014-03-16 Thread Sandip Nandi
Hi Bill , The following C code may help you , time_t is typedef to long int SEXP getTime() { time_t current_time; char* c_time_string; current_time = time(NULL); c_time_string = ctime(¤t_time); return mkString(c_time_String); // or if you want to return as int vector return s

Re: [Rd] How to convert time_t to R date object

2014-03-16 Thread Bill Wang
Hi Dirk, Thanks for your reply, I neede convert time_t to R type in C code, can not use Rcpp. Maybe Rcpp source code could help me. Cheers, Bill 2014-03-16 22:55 GMT+08:00 Dirk Eddelbuettel : > > On 16 March 2014 at 18:36, Bill Wang wrote: > | I am writing a R extensions, and I need pass time_

Re: [Rd] Does R ever move objecsts in memory?

2014-03-16 Thread Duncan Murdoch
On 14-03-16 7:51 PM, Ross Boylan wrote: R objects can disappear if they are garbage collected; can they move, i.e., change their location in memory? I don't see any indication this might happen in "Writing R Extensions" or "R Internals". But I'd like to be sure. Context: Rmpi serializes object

[Rd] Does R ever move objecsts in memory?

2014-03-16 Thread Ross Boylan
R objects can disappear if they are garbage collected; can they move, i.e., change their location in memory? I don't see any indication this might happen in "Writing R Extensions" or "R Internals". But I'd like to be sure. Context: Rmpi serializes objects in raw vectors for transmission by mpi.

Re: [Rd] How to convert time_t to R date object

2014-03-16 Thread Dirk Eddelbuettel
On 16 March 2014 at 18:36, Bill Wang wrote: | I am writing a R extensions, and I need pass time_t to R in C, but I don't | know how to do. | Can you give me some help? do not use double directly. Just treat it as an int: R> library(Rcpp) R> cppFunction("Date time_t2date(time_t what) { return

[Rd] How to convert time_t to R date object

2014-03-16 Thread Bill Wang
Hi all, I am writing a R extensions, and I need pass time_t to R in C, but I don't know how to do. Can you give me some help? do not use double directly. Thanks, Bill -- *Travel | Programming* *http://freecnpro.net* [[alternative HTML version deleted]]