Programming :: Finding The Day Of The Week In Different Timezones
Nov 10, 2010
I am using the following to find the Day of the Week on my server which is in UTC.
Code:
But say if I want to find the Day of the Week in another timezone, how would one go about it. I had a look at date --help but could not find any timezone related switches so am not sure if this is possible using this method.
Update:
This appears to work but is this the only way?
I was doing some testing which is required for some of my products
Here is the strange behaviour i observed
First i did set the timezone to PST 2010 (which is less than GMT basically negative timezone)
zdump -v /etc/localtime |grep 2010 /etc/localtime Sun Mar 14 09:59:59 2010 UTC = Sun Mar 14 01:59:59 2010 PST isdst=0 gmtoff=-28800 /etc/localtime Sun Mar 14 10:00:00 2010 UTC = Sun Mar 14 03:00:00 2010 PDT isdst=1 gmtoff=-25200
[Code]....
Note:in the above case when i did set time to 2:59:55 and said ok by then CEST became CET already. That could be the reason why DST is not happening.
I tried with few other positive and negative timezone configuration all the negative time zones resets back properly where as all the positive timezones doesn't
All my timezone files are up to date,i am using fedora 9
I like the clock applet in my system tray. It's nice to pull it open and see the time in other locations.
However, because of bandwidth, I'd like for it to stop requesting weather updates. Is there a way to prevent the weather from being requested while still showing the locations, and timezones on the clock map?
On Karmic, every once in a while this error pops up near the notification area at the top right (also see attachment):
Timezone Errors See Error Console: Unknown timezones are treated as the 'floating' local timezone.
But the 'date' command shows the correct date/time and timezone. /etc/timezone is also set correctly. The machine is running ntpd and is connected to the net 24/7 via ethernet. I also don't see any 'timezone' errors in /var/log/* Which software is complaining? What is the "Error Console" it is referring to?
Given the name of a mounted volume (e.g., /mnt/vol), how would I determine its capacity and available space in C? I've been googling for a while now and nothing jumps out as the solution. I can use getmntent() to get the name of the actual partition that is associated with the mount point, e.g. /dev/sda2, but I can't figure out how to find the capacity of the volume nor how much space is remaining, such as what the df command shows. Is there an ioctl defined to get this information or some other system call?
I am interfacing ADE7758 to At91sam9261 spi interface. Linux 2.6.28 is running on my custom board. have driver for this 12-bit ADC (ADE7758) on linux ?
I have a file in which I have string called "already there" in some line of it. I want that if the string is present enter some loop..
like if(( grep "already there" $file is true )) then -- -- fi
But the thing is when I make grep it gives the whole line in which this string is present and gives some error: if[ grep "already there" file ]: command not found. I am very new to shell scripting.
It does not seem to be finding perl but I do nt know why or what to do about it? could this be the problem? APACI_ARGS='--prefix=/usr/local/httpd_perl' I do not have the slightest ideal what that means or if I need it.
Someone knows how to change the first day of the week in the calendar popup to Monday?I already looked in /usr/share/gnome-shell/js/ui/calendar.js but I didn't saw where I have to change that (my knowledge of JavaScript isn't very good yet)
I want to extract all the common entries in the given 3 columns(fields) in the file using awk::can somebody tell me how it can be done in awk...the file is::
This simple task is proving harder then imagined. I have a multi-level directory that I'm trying to clean of duplicates, but I can't get 'find' to print what I need to see. To give an illustrative example, here is a dir:
Code: stuart@stuart:~/testdir$ ls * dir1: level2: dir1
So the output of find as i'd like it to work would show the two locations of dir1, which would be ./dir1 and ./level2/dir1. But no:
Code: stuart@stuart:~/testdir$ ls -d */ | head -1 | find . "`cat`" -type d . ./level2 ./level2/dir1 ./dir1 dir1/
I am trying to find IP address. In a socket programming tutorial, I found :
Code: $ nslookup localhost command. It gives me a address. However, one colleague told me :
Code: $ ifconfig
It also returns me inet_addr. But both are different. Kindly tell me the correct method to find IP address? I have also checked the /etc/hosts file but it says "localhost"
I would like, from a C program, find the hardware MAC address of the default route path. With BASH I can do a 'route' find 'default and then an ifconfig and grep for 'HWaddr'. Are there C calls to do the same??
anyone know that the ntfs's file sytem struct? is there's a API or something other could let me get this number? Or there is actually no such number in windows like the number of inode in linux?
im trying to write a makefile which contains :two cpp files and two header files. now i've put cppfiles in a folder called source whose path is: /root/workspace/source and header files in a folder called header whose path is:
/root/workspace/makedemo/header
my makefile is in the path:/root/workspace/makedemo my makefile was like this:
Code:
HEADERS = $(shell /root/workspace/makedemo/header ls *.h) SOURCES = $(shell /root/workspace/source ls *.cpp) COMPILERFLAGS = -W -Wall DEBUGFLAGS = -g
[code].....
im sure that i've given the correct path but it is showing errors like this:
[root@localhost makedemo]# make /bin/sh: /root/workspace/source: is a directory /bin/sh: /root/workspace/source: is a directory g++ -W -Wall -I. -o output g++: no input files make: *** [output] Error 1
I once had a script that when run would find the first 800GB of files in a directory (including subdirectories) and write them to a file (ie: ./800gb.sh > manifest.txt).I used this to create manifests of 800GB worth of data from large directories in order to dump to tape (LTO4).I'm sure its gotta be a pretty simple script, but I am not very skilled at writing bash scripts.
I installed ubuntu a mount ago, since then my vista goes bluescreen almost every week, I have vista business sp2 32bit and ubuntu 9.10 32bit dual boot. Details about one of bluescreens is below:
Problem signature: Problem Event Name: BlueScreen OS Version: 6.0.6002.2.2.0.256.6 Locale ID: 1033
Additional information about the problem: BCCode: be BCP1: 837020B7 BCP2: 28EA0860 BCP3: 8BB63A18 BCP4: 0000000E OS Version: 6_0_6002 Service Pack: 2_0 Product: 256_1
Files that help describe the problem: C:WindowsMinidumpMini020110-01.dmp C:Users afisehAppDataLocalTempWER-50060-0.sysdata.xml C:Users afisehAppDataLocalTempWER8304.tmp.version.txt Read our privacy statement: [URL]
I logged on my ibm600e with SUSE 11.1 + on Thanksgiving and auto update started and is still running today 12/02/2009. Pentium cpu is at 77 to 97% 93% memory usage plus some swap usage. Ethernet and wireless are activeily working
also separately the CD ROM is not detecting/detected except by the hardware report I sent in. My external Zip100 Is visible. as is the plug in floppy drive
I'm using ubuntu 9.04; I have a large project in windows that I want to "port" it in linux. It uses IPC mechanism "Shared memory" and also "Critical Section" APIs in windows, but unfortunately I have no good reference to change these windows APIs to their equivalent in linux?
Is there a comprehensive documentation or reference for this issues? I mean a table containing the equivalent APIs or systemcalls in windows and linux! For example, what's an alternative for the "InitializeCriticalSection" API in linux? Or an alternative for "CRITICAL_SECTION" structure? Or even an alternative for "RegOpenKeyEx", although we don't have registry in linux!!
AStar works on the basis of straight lines, AFAIK. In my case, we have geocoordinates and I can get the straight line distance between the waypoints. But I am wondering how approximate will the route calculated on this basis be? The actual distance "by road", which actually matters can be different.
Example. Assuming A and B are on the same plane, and will be equidistant from the goal point, if we consider a straight line between A and the goal point and, B and the goal point. The distance "by road" between A and the goal point may be greater or lesser than B. But because the AStar works on the basis of straight lines, it will return both the routes as the shortest. If yes, then which algo should be considered , if we want the results on the basis of actual distance in Km/m?
I want to get the hardware information in linux. As in windows we can have API to get the network adapter information and all. But in linux why dont we have? i try to read network adapter info in /proc/bus/devices file.. but that file is very hard to parse.and i looked at the lspci source c ode. but unfortunately I dint undersatnd that code to get the network adapter information.
Is there any equivalent of WaitFOrMultipleObjects on Linux?
I was finding a cross Platform library that allow you to run another program from your C++ application. I found POCO but it does not support functionality like WaitFOrMultipleObjects for both (linux and windows). I tried boost Process but its not official till now.
I have a cyclical problem. After a new fedora installation the calendar week start with sunday and I want to change it with monday. I tried with many guide without success (the latest is this: [URL]). Is possible to say how to change it? The version is fedora 14.