|
Hi All,
Does anyone know of a way to get an abbreviated time zone string? For example getting "PST" instead of "Pacific Standard Time"?
The following function looked promising but it returns the full time zone string regardless of the format:
size_t wcsftime(wchar_t *wcs, size_t maxsize, const wchar_t *format,
const struct tm *timptr);
The msdn documentation says that passing in %z or %Z as the format returns "Time-zone name or abbreviation; no characters if time zone is unknown" but as mentioned it always returns the full string regardless of which I use.
I looked in the registry thinking that each time zone key might possibly contain an abbreviation but found nothing. Here's one key I looked at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time"
Anyone have any ideas?
Thanks for your help,
Kellie
|
|
|
|
|
South_Bay_Girl wrote: Does anyone know of a way to get an abbreviated time zone string?
Parse the full name? Perhaps it is not useful since duplicate abbreviations render them ambiguous.
led mike
|
|
|
|
|
Thanks Mike, I'm hoping to find something a little more robust but I'll probably end up doing what you mention or making custom registry entries that contain the abbreviations.
Kellie
|
|
|
|
|
Is GetTimeZoneInformation() of any help?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I recently upgraded from Microsoft Visual Studio 2003 to 2005, and now my project won't compile, and I have no idea how to fix it.
The code that is broken:
// Copy Constructor
CImageManager(const &CImageManager);
// Assinment Operator
CImageManager operator = (const &CImageManager);
The error I recieve is:
1>c:\programming\programming\programs\calypso\imagemanager.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
These constructors are declared as private in a class so that only one instance can be created. This is happening with about 12 other files/classes as well.
Please let me know if anyone knows what is wrong with my syntax and why this all of a sudden changed in the new version of visual studio.
Thanks in advance,
Dustin
|
|
|
|
|
This worked in VS 2003?
// Copy Constructor
CImageManager(const &CImageManager);
// Assinment Operator
CImageManager operator = (const &CImageManager);
I thought it should be:
// Copy Constructor
CImageManager(const CImageManager &);
// Assinment Operator
CImageManager operator = (const CImageManager &);
|
|
|
|
|
Why does Microsoft have to go and fix things so not to allow my bad coding practices.
Yes, I just tried this and it fixes the problem. You are a life saver. If I ever meet you, the beer is on me.
|
|
|
|
|
mmmm ... beer
Cheers!
|
|
|
|
|
there is a problem with my miniport driver (passthru).when enabling hyperthreading. In normal cases it works correctly but when hyperthreading is enabled. the driver fails. is there any way to upgrade the driver so that it will work in hyperthreading mode
vineesh
|
|
|
|
|
Hello !
I have a function which must be in a "demon" thread because
I want that it still running until I close my program.
in fact this function is doing a polling with the hardware and it retreive any occured information from it.
I didn't work with thread or timer but is it a solution for my problem ?
thanks a lot
chokran
zizzzz
zizzzzzzzzzzzzzzz
|
|
|
|
|
i think you should document yourself about Windows services...
|
|
|
|
|
|
Hello,
CRICH is derived from CRichEditCtrl
int index=0;
vector<crich*>RichEditBox;
CRICH *p = RichEditBox[index];
p->SetFocus();
How do I go to index=1 box in the above example.
p++ will not help as I tried that
Any ideas
Prithaa
|
|
|
|
|
prithaa wrote: p++ will not help as I tried that
p++ won't workout because its not the base address and also 'p' is just a class pointer..which can point to single instance of that class.
use index++ instead of p++
Do your Duty and Don't expect the Result
|
|
|
|
|
Hello comunity
i use many times in my project "new" to create an object, in my case this is own class derived from
CObject! So, how to cleany the heap properly??
I hope that is my question is easy to understand?!
What ist different between this two my samples:
CMyClass* pMyClass = new CMyClass();
delete pMyClass;
CMyClass* pMyClass = new CMyClass();
pMyClass = NULL;
delete pMyClass;
thanks in advance
break;
|
|
|
|
|
break; wrote:
CMyClass* pMyClass = new CMyClass();
pMyClass = NULL;
delete pMyClass;
This won't work: you will first set the adress to a NULL pointer and then try to free the memory at this adress, which will fail (logical, because the memory at address 0x0000 was not allocated). You should first delete the pointed memory and then set your pointer to NULL to specify that the pointer doesn't point to a valid memory.
|
|
|
|
|
Thanks very much!
break;
|
|
|
|
|
Cedric Moonen wrote: This won't work:
As a minor technicality, it will WORK, but it won't work as expected. That is, there is nothing syntatically wrong with the code. deleting a null pointer is perfectly valid (and does nothing), but the code will have a memory leak since the memory allocated will never be deallocated.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Yes, that's what I wanted to say. Ok, it wasn't very clear :p. I know that you can delete a NULL pointer but this will simply be ignored (thus leaving a memory leak).
|
|
|
|
|
what were you thinking of when you wrote this ?
delete needs an adress to clean !! (the address which new returned when allocated the memory).
if you assign the pointer variable BEFORE delete ing, delete will try to free the memory at address 0 -> bug
but NULL ing after the delete is the thing to do...!
|
|
|
|
|
toxcct wrote: delete will try to free the memory at address 0 -> bug
That part isn't really a bug; the memory leak is, though. There is nothing wrong with deleting a null pointer.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
i was making it easy for the guy...
|
|
|
|
|
The two lines at the bottom must change places, otherwise you'll get a runtime error when trying to delete the NULL pointer.
The what-about-this-line -line is considered best practice because you will be able to check the pointer if it equals NULL.
Always NULLify pointers that are not used after freeing up their memory to be able to tell if the memory has been freed or not.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Roger Stoltz wrote: The two lines at the bottom must change places, otherwise you'll get a runtime error when trying to delete the NULL pointer.
Incorrect. There will be a memory leak, but there is no runtime exception in the code as written.
delete NULL;
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Yeah!
I was waiting for your post since I saw you lecturing crusade.
Seriously Zac, where can that be found in the C/C++ specs?
Isn't this an unspecified behaviour?
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|