Questions tagged [localtime]

Calendar time expressed relative to the user's local timezone.

Calendar time expressed relative to the user's local timezone.

461 questions
3
votes
1 answer

localtime_r consuming some memory before program exit

I use valgrind's massif to track memory usage at the last stage before program exit and found js::DateTimeInfo::updateTimeZoneAdjustment() (DateTime.cpp:19) which is calling localtime_r and consuming some memory. 16 ComputeLocalTime(time_t local,…
Denny
  • 449
  • 4
  • 17
3
votes
1 answer

Take milliseconds from localtime (without Boost!) in C

How can we do this (get local time with milliseconds) without Boost? I have something like this: time_of_day = time(NULL); time_str_tm = localtime(&time_of_day); printf("\n%02i:%02i:%02i\n", time_str_tm->tm_hour, time_str_tm->tm_min,…
Ksenia
  • 33
  • 1
  • 5
3
votes
0 answers

localtime returns seeing inconsistent results for tm_wday

Not sure if this is a timezone problem: currently on SGT. Following code reports Fri, 17 April 2009 as day of week 6 (??), but Fri, Jan 2 as day of the week 5. #include #include #define ONE_DAY 86400 int main() { time_t…
myk
  • 708
  • 2
  • 8
  • 20
3
votes
3 answers

/usr/share/zoneinfo epic fail

I have just, in my groggy morning state, reversed & confused the arguments to ln, replacing /usr/share/zoneinfo/America/Toronto with a link to the non-existant /etc/localtime, when I really wanted to link /etc/localtime to Toronto. Now I have no…
nullpointer
  • 191
  • 1
  • 7
3
votes
1 answer

Showing date and time by visitor's computer time zone

I want my wordpress posts and comment date and time to be converted to visitors computer time zone. That way user should know what exact time post or comment was created by his local time. I know that cloaking is bad seo practice when you show…
lelemon
  • 31
  • 2
3
votes
4 answers

Perl Past Date How To?

I have a perl script that is getting the current time coming through in a but I am also looking to get the date 45 days prior to the current time as well. Here is what I have: *already tried using date::calc DHMS which is why the second is formatted…
3
votes
3 answers

How can I get start of month in epoch form from random epoch timestamp in Perl?

I get some times from a database and I am trying to store them by month, using the epoch form. So I could have some random times like: 1354120744 1328978360 1297388332 and for each one I want to find the epoch value which represents the 1st of…
dgBP
  • 1,681
  • 6
  • 27
  • 42
3
votes
1 answer

How to convert time.gmtime()-like tuple to UNIX time?

time.mktime is said to be the reverse of time.localtime. Where is the reverse of time.gmtime? It is needed to convert the result of email.utils.parsedate to normal UNIX time. The only approximation is hack like…
Vi.
  • 37,014
  • 18
  • 93
  • 148
2
votes
2 answers

Time zone and BST woes in Europe/London

I am really struggling with my hwclock since the UK changed to British Summer Time (BST) last weekend on my Centos 5.8 KVM guest. Here's some command outputs.. [root@host ~]# TZ=Europe/London date Mon Apr 2 08:12:03 EDT 2012 …
Daniel Procter
  • 188
  • 1
  • 2
  • 16
2
votes
1 answer

fprintf doesn't print const char * to file

I have a simple log function that needs to print the current date and time. I'm doing it inside a function that returns a char *. When I try to set this char * into fprintf(), it doesn't print me the string into the file: why? Here is the function…
user63898
  • 29,839
  • 85
  • 272
  • 514
2
votes
4 answers

How to extract timezone from localtime()?

I'm using the following code to print the current time. use Getopt::Long; use Time::Local; sub gettime { my $t = time(); my ($sec,$mn,$hr,$mday,$mon,$yr,@left, $dstr); ($sec,$mn,$hr,$mday,$mon,$yr,@left) = localtime($t); …
user379151
  • 1,289
  • 1
  • 16
  • 25
2
votes
2 answers

UTC Time to GMT+2 in AS3

I'm having a problem. Using the Date() functions AS3 provides natively, I'm converting UTC time to local machine time. The problem I have is this, look at month and hour. 2011-10-07 18:45:00 -> 2011-10-07 21:45:00 2011-11-07 18:45:00 -> 2011-11-07…
Francisc
  • 77,430
  • 63
  • 180
  • 276
2
votes
0 answers

How to save time (Localtime) from WheelTimePicker on API 24?

I have a project on Jetpack Compose where I need to make a Wheel time picker to choose the time. I found a solution that looked acceptable. https://github.com/commandiron/WheelPickerCompose Then I got a task to save the chosen time to variable or…
2
votes
3 answers

Is there any date/time function that handles tomorrow's date including carry over into next month?

I have a function that needs to calculate yesterday's, today's and tomorrow's date. I use localtime to get today's date. I add 1 to tm_mday in order to get tomorrow's date. The issue is if the current date is 3/31, it will become 3/32 if I add 1 to…
Tyler
  • 63
  • 2
  • 9
2
votes
2 answers

localtime() giving the wrong date in C

I'm trying to print out the local time on my computer using C' localtime() function; The default format of my locale is mm/dd/yyyy, so The expected output is: 03/04/2023 12:51:43 But I get: 04/02/2023 12:51:43 I was thinking, maybe the localtime…
moisedk
  • 58
  • 7